Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Afffected occurence name - Constrain

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
gopinathmY575P
175 Views, 2 Replies

Afffected occurence name - Constrain

Hello Community.,

 

 im working on macro, where i need occurence name based on constrain.

 

when i loop thru each constrain, for some mates, it shows one of the occurence is nothing. what is the  cause of the error.

 

is this due to parts located in different levels,.?

 

For Each oConstr In oConstrs

        debug.print  oConstr.OccurrenceOne.name & " ! " & oConstr.OccurrenceTwo.name

next

gopinathmY575P_0-1666169512905.png

 

 

Thanks in advanc.,

 

2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: gopinathmY575P

Hi @gopinathmY575P.  The online help documentation for some of these properties is not as informational as they could be, so they do not mention if they may return Nothing, and/or under what conditions/situations that might happen. I would suspect that if you constrained a component to one of the main assembly's work features, such as a WorkPlane, WorkAxis, WorkPoint, WorkSurface, etc, then the constraint would not be associated with two components, but just the one.  Perhaps this is the case for your situation.

Also keep in mind that the AssemblyConstraint is a simple base class for an entire group of more specific types of assembly constraint objects that are derived from that class, such as the AngleConstraint, FlushConstraint, & MateConstraint, just to name a few.  Sometimes to get better information you have to first identify which sub-type of constraint it is, then declare that more specific type of variable, and set this object as its value, then inspect that version, so that its more specific properties & methods will be available.  This is mostly only necessary when attempting to access their controlling parameters though.

 

PS.  If the other component were in another level of the assembly, such as a lower level, that would most likely return a ComponentOccurrenceProxy object, instead of a regular ComponentOccurrence object, but not Nothing.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
gopinathmY575P
in reply to: WCrihfield

Hello @WCrihfield, thank you very much for the clarification and support. I got clarity over this.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report