Hello everybody,
I am new to this forum and new to CATIA VBscripting/VBA and Im having some difficulty understanding some concepts. I hope someone here will be so kind to explain a few things to me.
I recorded a macro that intersects a line with a surface (see code below).
1. Now the first thing I don't understand is why the first element, the line, is defined as a parameter. Could anyone explain to me why this is done like this? Is it not just a hybridshape like the surface?
2. The second thing I am having trouble with is that in my part I have another geometrical set of lines which have been created earlier, now when I rerun the macro the line in that set is selected for the intersect, how do I control this? I have been trying to figure out a way to properly reference this but have not been able to figure it out.
3. What does the PointType property control and what other options are there? the catia documentation only gives me the following:
Property PointType( ) As long
Returns or sets the PointType flag for intersect.
Any help is highly appreciated.
Thanks
I am new to this forum and new to CATIA VBscripting/VBA and Im having some difficulty understanding some concepts. I hope someone here will be so kind to explain a few things to me.
I recorded a macro that intersects a line with a surface (see code below).
1. Now the first thing I don't understand is why the first element, the line, is defined as a parameter. Could anyone explain to me why this is done like this? Is it not just a hybridshape like the surface?
2. The second thing I am having trouble with is that in my part I have another geometrical set of lines which have been created earlier, now when I rerun the macro the line in that set is selected for the intersect, how do I control this? I have been trying to figure out a way to properly reference this but have not been able to figure it out.
3. What does the PointType property control and what other options are there? the catia documentation only gives me the following:
Property PointType( ) As long
Returns or sets the PointType flag for intersect.
Code:
Language="VBSCRIPT"
Sub CATMain()
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("Part1.CATPart")
Set part1 = partDocument1.Part
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set parameters1 = part1.Parameters
Set hybridShapeLineExplicit1 = parameters1.Item("Line.1")
Set reference1 = part1.CreateReferenceFromObject(hybridShapeLineExplicit1)
Set hybridShapeOffset1 = part1.HybridBodies.Item("GeoSet1").HybridBodies.Item("GeoSet2").HybridShapes.Item("Offset.Surface")
Set reference2 = part1.CreateReferenceFromObject(hybridShapeOffset1)
Set hybridShapeIntersection1 = hybridShapeFactory1.AddNewIntersection(reference1, reference2)
hybridShapeIntersection1.PointType = 0
Set hybridBody3 = part1.HybridBodies.Item("GeoSet1").HybridBodies.Item("GeoSet2").HybridBodies.Item("GeoSet3")
hybridBody3.AppendHybridShape hybridShapeIntersection1
part1.InWorkObject = hybridShapeIntersection1
part1.Update
End Sub
Any help is highly appreciated.
Thanks