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
Thanks in advanc.,
Solved! Go to Solution.
Solved by WCrihfield. Go to Solution.
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
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.