Hello,
Need your help guys, I`m pretty sure it is easy, but I cant figure out the way to do this.
What I have is the nameplate.ipt, that can be configured using iLogic form, code creates a new drawing nameplate.idw with front view of the nameplate and BOM in the corner. The last things I need are:
1. Push parameter - job number from nameplate.ipt to nameplate.idw
2. Add two dimensions - width and length. I do have an external rule that can do this easily. What I want is these two dimensions to be added automatically on nameplate.idw. So I guess the nameplate.ipt should have a rule to run the ilogic code in nameplate.idw. Is this possible? Or there is a different approach?
external rule.
Sub Main Dim oDrawDoc As DrawingDocument = ThisDoc.Document Dim oSheet As Sheet = oDrawDoc.ActiveSheet RetrieveDimByView(oSheet, "VIEW1", "PlateHeight") ' front view RetrieveDimByView(oSheet, "VIEW1", "PlateLength") End Sub Sub RetrieveDimByView(ByVal oSheet As Sheet, ByVal ViewName As String, ByVal PrefixStr As String) Dim oDrawView As DrawingView For Each oDrawView In oSheet.DrawingViews If oDrawView.Name = ViewName Then Exit For End If Next Dim oGeneralDimensionsEnum As GeneralDimensionsEnumerator oGeneralDimensionsEnum = oSheet.DrawingDimensions.GeneralDimensions.Retrieve(oDrawView) Dim oGeneralDimension As GeneralDimension For Each oGeneralDimension In oGeneralDimensionsEnum Dim oParameter As Parameter Try oParameter = oGeneralDimension.RetrievedFrom.Parameter Catch ' Error to set oParameter. ' Go further to delete the dimension. End Try If oParameter.DrivenBy.count <> 0 Then Dim oDrivenByParameter As Parameter For Each oDrivenByParameter In oParameter.DrivenBy If InStr(oDrivenByParameter.Name, PrefixStr) = 0 Then oGeneralDimension.Delete End If Next Else If InStr(oParameter.Name, PrefixStr) = 0 Then oGeneralDimension.Delete End If End If Next oSheet = Nothing Dim oCommandMgr As CommandManager = _ ThisApplication.CommandManager oCommandMgr.ControlDefinitions.item("DrawingSelectAllInventorDimsCmd").Execute oCommandMgr.ControlDefinitions.item("DrawingArrangeDimensionsCmd").Execute End Sub
Any help is appreciated. Thank you.
I think this link will help with the iproperty.
If the dimension already exists in the model perhaps this post may help you to retrieve the dimension in the drawing.
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Retrieve-dimensions/td-p/3650292
I hope this helps!
Best Regards,