how can I get the coordinates with reference AxisSystem?
how can I get the coordinates with reference AxisSystem?
(OP)
Hello, guys.
I'm trying to make a macro which can make coordiante points as much as what I want.
So I recorded to make coordinate points with Axis System and I modified this code.
And I got a problem in here.
If I select the Axis which is in the "Axis Systems", then it works very well.
On the other hand, if I select the Axis which is in a "Geometrical Set", then it doesn't work.
Actually I would like to get the coodinate points with reference AxisSystem in the both side, in the "Axis Systems" and the "Geometrical Set".
I have also googled about this theme, but I didn't find anything.
Could you check my code inside, please?
I'm trying to make a macro which can make coordiante points as much as what I want.
So I recorded to make coordinate points with Axis System and I modified this code.
And I got a problem in here.
If I select the Axis which is in the "Axis Systems", then it works very well.
On the other hand, if I select the Axis which is in a "Geometrical Set", then it doesn't work.
Actually I would like to get the coodinate points with reference AxisSystem in the both side, in the "Axis Systems" and the "Geometrical Set".
I have also googled about this theme, but I didn't find anything.
Could you check my code inside, please?
CODE --> VBSCRIPT
Set partDocument1 = CATIA.ActiveDocument
Set part1 = partDocument1.Part
Dim InputObjectType(0)
InputObjectType(0)="AxisSystem"
Set partDocument1 = CATIA.ActiveDocument
Set selection1 = partDocument1.Selection
Set part1 = CATIA.ActiveDocument.Part
Do
selection1.Clear
Status1 = selection1.SelectElement2(InputObjectType, "Select an AnyObject", True)
Set selectionAxis1 = selection1.item(1).value
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(100.000000, 100.000000, 100.000000)
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Item(selectionAxis1.name)
Set reference1 = part1.CreateReferenceFromObject(axisSystem1)
hybridShapePointCoord1.RefAxisSystem = reference1
Set hybridBodies1 = part1.HybridBodies
Set hybridBody1 = hybridBodies1.Item("Geometrical Set.2")
hybridBody1.AppendHybridShape hybridShapePointCoord1
part1.InWorkObject = hybridShapePointCoord1
part1.Update
Loop





RE: how can I get the coordinates with reference AxisSystem?
Set axisSystems1 = part1.AxisSystems
Set axisSystem1 = axisSystems1.Item(selectionAxis1.name)
Axis System.3 is not located in the Root AxisSystems collection so the code cannot retrieve it by name from that collection. You already have the object in the Selection collection so you should just be able to utilize the SelectionAxis1 object for the reference creation. If don't have any use for the object Containing the Axis System in the tree, you really don't need to capture it in a variable for this application.
--Doug
RE: how can I get the coordinates with reference AxisSystem?
Thank you for your answer.
I have to select the Axis System which is contained in the Geo Set.
So do you have any ideas to solve this problem?
RE: how can I get the coordinates with reference AxisSystem?
Translation:
Set selectionAxis1 = selection1.item(1).value <-You retrieved the Object with the selection process
Set hybridShapeFactory1 = part1.HybridShapeFactory
Set hybridShapePointCoord1 = hybridShapeFactory1.AddNewPointCoord(100.000000, 100.000000, 100.000000)
Set axisSystems1 = part1.AxisSystems <- Not necessary
Set axisSystem1 = axisSystems1.Item(selectionAxis1.name) <- Not necessary
Set reference1 = part1.CreateReferenceFromObject(selectionAxis1 ) <- Modified
RE: how can I get the coordinates with reference AxisSystem?
Thank you for your kindness.
It was very simple to think to modify that..
I'm so sorry to bother you.
I will try to solve a Problem once more on next time.
I really thank you.