Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating idw, adding dim`s to the idw drawing using iLogic rule from ipt part

1 REPLY 1
Reply
Message 1 of 2
achmidt
851 Views, 1 Reply

Creating idw, adding dim`s to the idw drawing using iLogic rule from ipt part

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.

 

Inventor Virtual Parts Addin

http://apps.exchange.autodesk.com/INVNTOR/en/Detail/Index?id=appstore.exchange.autodesk.com%3Avirtualpartsadd-in_windows32and64%3Aen
1 REPLY 1
Message 2 of 2
innovatenate
in reply to: achmidt

I think this link will help with the iproperty.

 

http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Get-iProperties-from-part-in-drawing-w...

 

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,

 

 




Nathan Chandler
Principal Specialist

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report