Auto-Auto-Reattach?

Auto-Auto-Reattach?

mrattray
Advisor Advisor
986 Views
5 Replies
Message 1 of 6

Auto-Auto-Reattach?

mrattray
Advisor
Advisor

Is it possible to auto-reattach dimensions programatically?

I have an assembly that I'm suppressing/unsuppressing parts in and my drawing dimensions keep getting orphaned. I discovered the "Preserve Orphaned Annotations" option, which keeps them from disappearing on me. I can then reattach the dimensions via the design doctor, but who wants to click the doctor 6 times for 20+ dimensions?

 

Thanks,

Mike

Mike (not Matt) Rattray

0 Likes
987 Views
5 Replies
Replies (5)
Message 2 of 6

mrattray
Advisor
Advisor

My current plan here is a loop that itterates through each dimension and checks it's attachment status, reattaches if it needs it or deletes it if it fails reattachment.

Something like:

 

For Each dimension In dimensions

     If dimension.Attached = False then

           [auto-reattach line]

           If Err <> 0 Then

                dimension.Delete

                Err.Clear

           End If

      End If

Next

 

What I need is the auto-reattach part. I can't find anything about reattachment in the help, the object browser, or in the forums.  Is the design doctor and it's methods (pun!) not exposed?

 

Thnaks,

Mike

Mike (not Matt) Rattray

0 Likes
Message 3 of 6

Anonymous
Not applicable

Did you resolve this?

 

i've got this exact problem, tried doing a recreate of the dimension, like so..

 

Inventor.LinearGeneralDimension lDim = d as Inventor.LinearGeneralDimension;
                    Inventor.LinearGeneralDimension newDim = sheet.DrawingDimensions.GeneralDimensions.AddLinear(d.Text.Origin, lDim.IntentOne, lDim.IntentTwo, lDim.DimensionType, lDim.ArrowheadsInside, lDim.Style, lDim.Layer);
                    newDim.Text.Color = lDim.Text.Color;
                    newDim.Text.FormattedText = lDim.Text.FormattedText;

 

but didn't work.

 

-Doug

0 Likes
Message 4 of 6

mrattray
Advisor
Advisor

No I haven't been able to come up with anything along the workflow I had posted. It appears to me that the function simply isn't exposed.  I've been using a complicated and tideous work around for what I was trying to do.

Mike (not Matt) Rattray

0 Likes
Message 5 of 6

Anonymous
Not applicable

Found somebody that had an idea that worked...

thought you would like to know

 

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/How-to-locate-orphaned-Dimensions-on-D...

 

-Doug

0 Likes
Message 6 of 6

josiah.fordCEEGJ
Explorer
Explorer

This is a just a few years later than the original post! But for sake of anyone still wondering. Here is a full code that will auto-reattach anything possible.

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim UNDO As Transaction = ThisApplication.TransactionManager.StartTransaction(oDoc, "Auto Reattach")
For Each oDim As DrawingDimension In oDoc.ActiveSheet.DrawingDimensions
	If oDim.Attached = False
		oDoc.SelectSet.Select(oDim)
			Try
				ThisApplication.CommandManager.ControlDefinitions.Item("DLxAnnoReconnectCmd").Execute
			Catch
			End Try
		oDoc.SelectSet.Clear
	End If
Next
UNDO.End