Get Coordinates of WorkPoints into AddAssetInstances

Get Coordinates of WorkPoints into AddAssetInstances

matthew_neesley
Collaborator Collaborator
451 Views
2 Replies
Message 1 of 3

Get Coordinates of WorkPoints into AddAssetInstances

matthew_neesley
Collaborator
Collaborator

Hello to all:

I need some Inventor coding assistance.  I know where to do it, and I know how to go about doing it...but the last step is writing code to do it, and I simply don't know how.  I've attached a pic for reference.  

 

I'm trying to insert conveyor leg parts/assets using AddAssetInstances.  I want the insertion points to end up at the same points as the defined Work Points on already-inserted Conveyor bed assets.  I know you can extract the global coordinates of workpoints...now how do I get them all into the AddAssetInstances code sequentially so that the legs come in with their Insertion Points on top of the beds' Work Points?

 

Thanks in advance, you'd be an enormous help if this can work!!get workpoints into AddAssetInstances.JPG

 

0 Likes
Accepted solutions (2)
452 Views
2 Replies
Replies (2)
Message 2 of 3

kelly.young
Autodesk Support
Autodesk Support
Accepted solution

Hello @matthew_neesley one common issue is understanding the difference between native objects and proxy objects. There is a "Workpoints" collection as a property on the component definition. But it matters whether you're getting that from a document, directly (native), or from a component occurrence (proxy). Consider the "Center Point" workpoint. If you ask for it via the document, its x/y/z will always be 0/0/0. But if you ask for it via an occurrence, the x/y/z will be relative to the parent assembly.

 

Here are the documentation links that should be helpful:

Proxies

WP Collection

WP Object

WorkPointProxy Object

Note that this is pretty much the same as WP object; it just returns coordinates/etc, relative to parent assembly.

 

Please select the Accept Solution button if a post solves your issue or answers your question.

0 Likes
Message 3 of 3

matthew_neesley
Collaborator
Collaborator
Accepted solution

I just realized I've been going about this ALL. WRONG.  I grabbed all the coordinate values from the beds.  Now I can do the same thing after the legs are inserted, grab the z values again (...but this time FROM THE LEGS), then push all those values through to the "height" parameter of the leg parts with Excel (maybe...)  

0 Likes