Hello,
I'd like to create a drawing of an assembly that deletes a dimension of a part if the part has been suppressed and adds dim back when part is unsuppressed.
Any piece of code that will do the trick?
Thanks,
Alberto.
Just an idea.
You may develop code that moves all orphaned dimensions to some special layer that could hide them.
For Each dimension In dimensions
If dimension.Attached = False then
Dimension.Layer = HiddenLayerObject
End If
Next
And vice versa non- orphaned dimensions could be moved from the hidden to visible layer.
Hi Vladimir,
I tried the code but it doesn't seem to be working. I cannot change the layer in the drawing through a rule.
Also, when the part is supressed in the assembly the dimension gets deleted, making it impossible to change the dimension layer. (Orphaned dimension don't exist because they get deleted as soon as they become orphaned)
Attached is a simplified assembly. I'd like to suppress and unsupress "Rod_1" in the assembly and do the same with its respective dimension on the drawing.
Thanks,
Alberto.
Hi Alberto,
It looks like method described in http://adndevblog.typepad.com/manufacturing/2013/08/hide-drawing-dimensions-which-are-orphaned.html works for parts but does not work for assemblies.
Component suppression in the assembly deletes all the associated dimensions in the drawing view. They do not exist in the DrawingDimensions collection any more and thus cannot be easily restored.
You have to recreate disappeared dimensions. The implementation of this procedure essentially depends on your intent and model complexity. You may either retrieve desired dimensions or you should be able to find GeometryIntent objects required for new dimension. IMHO Inventor.Attribute object could be useful for this purpose.
This post is a good start point to learn drawing automation: http://modthemachine.typepad.com/my_weblog/2009/10/drawing-automation.html
Webcast archive: http://adndevblog.typepad.com/manufacturing/2013/05/api-webcast-archive.html
Cheers,
I was hoping that Inventor Developers would have finally addressed this short-coming with the new Model State behaviour found in Inventor 2022 and Inventor 2023. But unfortunately, after testing with the latest patched Inventor 2023, it's still not possible to recover a dimension that's tied to a drawing view of a suppressed part within an assembly. Any dimension that's half consumed becomes orphaned (such as a linear dim between a suppressed and unsuppressed component), and any loose dimension (that's strictly tied to a suppressed component) is simply deleted and doesn't return upon the component returning to an unsuppressed state by toggling the the Model State.
This is extremely frustrating. 😟 For a dynamic model where the model state switches back-and-forth, traditional dimensions on any dynamically suppressing parts within any drawings will eventually delete or orphan themselves.
So... what's the solution?
There may be workarounds, but most are labour intensive and ugly to work with. I think I might hit up the idea station... assuming this hasn't already been requested.