Nested geometry proxy for constraints

Nested geometry proxy for constraints

oransen
Collaborator Collaborator
479 Views
4 Replies
Message 1 of 5

Nested geometry proxy for constraints

oransen
Collaborator
Collaborator

Imagine I am making an assembly which constrains two other assemblies. And I want to constrain using axes within parts within the two sub assemblies. 

 

Constrain two axesConstrain two axes

 

I can't seem to get the correct proxies, is what I am doing possible?

 

Is there an example of doing this?

 

TIA,

 

Owen

 

 

0 Likes
Accepted solutions (2)
480 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor
Accepted solution

Hi @oransen.  Yes, what you are describing is possible to do both manually, and by code.  It is just complicated to explain all the steps needed to accomplish this by code, especially without having all the more specific information. 

 

The first step is making sure you are familiar with what proxies are, and how to obtain them.  Here is a link to a post that attempts to briefly explain what proxies are.  To accomplish this task, you will need to first get a reference to the main assembly, then a reference to the two top level components that represent the two sub assemblies.  Then get a reference to the two components that represent the parts within those sub-assemblies.  Then dig down into the 'definition' of both of those parts to get the WorkAxis object you want to use for your constraint.  Then you will need to step you way back up from that level to the top level, getting a reference to the 'proxy' version (WorkAxisProxy) of those two WorkAxis objects at each of the two levels going back towards the top level.  Then you will have a reference to two WorkAxisProxy objects that you can use for creating a top level assembly constraint.

 

The main tool for making this happen is the CreateGeometryProxy method of the ComponentOccurrence object.  This is not really used to 'create' any new geometry, but rather to get a reference to supplied piece of geometry at the parent assembly level (not necessarily top assembly level).  In this example, you would use the component representing the part to do this the first time, then the component representing the sub-assembly.  This proxy object will be like a copy of the original, but it only exists within the 3D coordinate space of the parent assembly.  Then if that 'parent' assembly was not the 'top level' assembly, you will need to do this step again to get to the top level.  So, use your reference to the sub-assembly level proxy object as input to the CreateGeometryProxy method, in order to obtain a reference to the proxy of it within the 3D coordinate space of the top level assembly.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

oransen
Collaborator
Collaborator

Thanks for the reply...

 

Aha! So I need to

 

  1. get proxy1 in sub iam from part
  2. get proxy2 in main iam from from sub iam using proxy1 as input

Have I understood?

 

I was not sure I could use CreateGeometryProxy with proxies as an input...

 

Owen

 

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor
Accepted solution

Yes, that sounds correct.  Yes, you can supply proxy objects as input to the CreateGeometryProxy method.  The variable you use as the second input should be a variable that you have already declared its Type, but have not yet set a value to, then this method will set its value for you.  This is how you get a 'reference' to the proxy of that object at the next level up.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5

oransen
Collaborator
Collaborator
Many thanks...
0 Likes