Hi all,
I have created master assembly and drawing, using ilogic rules I am creating one more copy of these files(using SaveCopyAs command). In the newly created assembly some of the parts will be suppressed, the dimensions given to these suppressed parts showing as un attached, I need to hide/delete these dimensions.
I have written following rule. What I am doing is moving the un attached dimensions to new layer (dummy) and switch off this layer. When I run this rule, it is giving error. Any help will be greatly appreciated
doc = ThisDoc.Document
Dim oHideLayer
oHideLayer = doc.StylesManager.Layers.Item("Dimension (ANSI))").Copy("dummy")
'iterate each dimension
Dim oEachDim As DrawingDimension
For Each oEachDim In doc.ActiveSheet.DrawingDimensions
'If it Is orphaned
If Not oEachDim.Attached Then
' set the layer to the dummy layer
oEachDim.Layer = oHideLayer
EndIf
Next
'hide this layer
oHideLayer.Visible = False
doc.Update
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi rudresh_middleby,
I agree with mrattray's thought that the Inventor Customization Forum would be a better place for this type of question, but here is an ilogic rule that follows pretty close to what you had:
oHideOption = InputRadioBox("Select an option:", _ "Hide Orphan Dimensions", "Show Orphan Dimensions", True, "iLogic") oDoc = ThisDoc.Document Try 'try to create the layer oOrphanLayer = oDoc.StylesManager.Layers.Item(1).Copy("Orphan Dims") Catch 'assume error means layer already exists and 'assign layer to variable oOrphanLayer = oDoc.StylesManager.Layers.Item("Orphan Dims") End Try If oHideOption = True Then 'Loop through all dimensions Dim oDrawingDim As DrawingDimension For Each oDrawingDim In oDoc.ActiveSheet.DrawingDimensions 'look at only unattached dims If oDrawingDim.Attached = False Then ' set the layer to the dummy layer oDrawingDim.Layer = oOrphanLayer End If Next 'hide the layer oOrphanLayer.Visible = False Else 'show the layer oOrphanLayer.Visible = True End If oDoc.Update
Also here is a rule to delete the unattached dimensions, just in case it helps:
oDoc = ThisDoc.Document 'Loop through and delete all unattached dimensions For Each oDrawingDim In oDoc.ActiveSheet.DrawingDimensions If oDrawingDim.Attached = False Then 'delete unattached dims oDrawingDim.Delete End If Next
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis, Thanks for the feedback.
Your second suggestion worked really well. Thanks a lot
Hi everyone,
I was asked about Orphan Centerlines on another thread, so I thought I would add this information here in order to keep things tied together. So here is a quick example that deletes un-attached (orphaned) dimensions, centermarks, and centerlines.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
oDoc = ThisDoc.Document 'Delete all orphaned dimensions For Each oDrawingDim In oDoc.ActiveSheet.DrawingDimensions If oDrawingDim.Attached = False Then oDrawingDim.Delete End If Next 'Delete all orphaned centermarks For Each oCenterMark In oDoc.ActiveSheet.Centermarks If oCenterMark.Attached = False Then oCenterMark.Delete End If Next 'Delete all orphaned centerlines For Each oCenterLine In oDoc.ActiveSheet.Centerlines If oCenterLine.Attached = False Then oCenterLine.Delete End If Next
I need your help your rule is working for me but only if annotations are unattached intentionally by me if I make a replace model reference some annotations will loose track in that case I'm not being able to delete them.
The only way it's working is if I move them a little then they start to assume they are actually lost.
Attached is my file.
I tried this change but it didn't work, could you rewrite the ilogic for me please?
If oCenterMark.Attached <> True
Can't find what you're looking for? Ask the community or share your knowledge.