×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

how can I get the coordinates with reference AxisSystem?

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?

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?

The Problem lies with these two statements:

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?

(OP)
Hi, Doug
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?

From Above: "You already have the object in the Selection collection so you should just be able to utilize the SelectionAxis1 object for the reference creation."

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?

(OP)
Hi, Doug
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources