ILogic for derived part

ILogic for derived part

nsatheesan34D64
Advocate Advocate
229 Views
1 Reply
Message 1 of 2

ILogic for derived part

nsatheesan34D64
Advocate
Advocate

Hi all..

 

I have a ipt file with multi solids. I am just wondering if there is an iLogic code to derive each of these solid to separate .ipt files & control the iproperties, appearance, material etc.. using iLogic in parent file? Is that possible..? Anyone has a sample code to share.. Thanks..

0 Likes
230 Views
1 Reply
Reply (1)
Message 2 of 2

basautomationservices
Advocate
Advocate

This is possible. I use the following code to create a derived part with one solid in it. Your other questions you will find the answers by searching google/the forum.

 

 

Private Function CreatePart(ByVal sb As SurfaceBody, ByVal fullFilename As String) As PartDocument
    Dim template = "C:\users\public\documents\autodesk\inventor 2021\templates\en-us\metric\standard (mm).ipt"
    Dim newPart As PartDocument = CType(invApp.Documents.Add(DocumentTypeEnum.kPartDocumentObject, template, False), PartDocument)
    Dim dpcs As DerivedPartComponents = newPart.ComponentDefinition.ReferenceComponents.DerivedPartComponents
    Dim dpd As DerivedPartUniformScaleDef = dpcs.CreateUniformScaleDef(fullFilename)
    dpd.ExcludeAll()

    For Each dpe As DerivedPartEntity In dpd.Solids

        If dpe.ReferencedEntity.Name = sb.Name Then
            dpe.IncludeEntity = True
        End If
    Next

    dpcs.Add(CType(dpd, DerivedPartDefinition))
    Return newPart
End Function

 

 

 

edit: the fullfilename passed is the filename of the master part

Contact me for custom app development info@basautomationservices.com. Follow below links to view my Inventor appstore apps.

Free apps: Smart Leader | Part Visibility Utility | Mate Origins

Paid apps: Frame Stiffener Tool | Constrain Plane Toggle | Property Editor Pro