How to create an edge proxy and use it in a constraint

How to create an edge proxy and use it in a constraint

MTheDesigner
Advocate Advocate
1,700 Views
5 Replies
Message 1 of 6

How to create an edge proxy and use it in a constraint

MTheDesigner
Advocate
Advocate

Hi, I am trying to make code that constrains selections together, I have found out that proxies are supposed to be used in assemblies to avoid having to name edges in the individual parts. I have had success creating proxy edges using the part.CreateGeometryProxy(myEdge,ProxyEdge) command. However, this proxy edge doesn't seem to have a name. As a constraint requires an entity string input, I am unsure of how I can identify the proxy for use.

 

Edit: Corrected command that was referenced.

0 Likes
1,701 Views
5 Replies
Replies (5)
Message 2 of 6

WCrihfield
Mentor
Mentor

If doing it by API means (instead of with an iLogic snippet), the ComponentOccurrence object has a method called CreateGeometryProxy() that is used to get/create a proxy object for use in an assembly.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 6

WCrihfield
Mentor
Mentor

If entities have not already been named or otherwise tagged in some way, then you must use other means to identify/find which source entity you want to create a proxy of for use in your assembly constraints.  If there does not appear to be any other way to find or identify the entity you need by code, then automation of the constraints by code may simply not be possible.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 6

MTheDesigner
Advocate
Advocate
Hi @WCrihfield Sorry about the error inn my post. I am already using the CreateGeometryProxy() method. The thing that I am getting hung up on is that the edge proxy doesn't have a name. I know that it has EdgeProxy.AttributeSets.Add() My understanding is that this should allow me to place a name, but it returns an attribute set instead of changing it. So I don't understand what I should be doing.
0 Likes
Message 5 of 6

MTheDesigner
Advocate
Advocate

I do have a way of selecting the edge. I am creating the proxy with an edge selected by the user. I just need to name the edge somehow. This must be possible. The normal constraints tool creates a named edge that can be seen when you use Capture Current State (Components Constraints.Add)

0 Likes
Message 6 of 6

WCrihfield
Mentor
Mentor

OK.  So, if you are going to use the AttributeSets and Attributes to find things, you must first have created an AttributeSet and Attribute(s) on the objects ahead of time, that contain something like a name or unique data, that will tell you exactly which object it is, so that you will be able to immediately find this one object among all the other objects you may have done this to.  AttributeSets and Attributes are saved in the document in which those objects exist.  If you create an AttributeSet and an Attribute within that set, on a proxy object, in an assembly, that AttributeSet and that Attribute will only exist in that assembly document where the proxy is in the context of, not in the sub-assembly or part document that the proxy was created from as a source.  With that in mind, if you want to be able to repeatedly insert a component and constrain it into other assemblies by code, then you pretty much have to do the preparation work ahead of time, by naming or otherwise tagging those entities in the source model files.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes