access Derived Part object

access Derived Part object

Anonymous
Not applicable
388 Views
3 Replies
Message 1 of 4

access Derived Part object

Anonymous
Not applicable

Is it possible to access blocks object of derived part?

0 Likes
389 Views
3 Replies
Replies (3)
Message 2 of 4

CCarreiras
Mentor
Mentor

Yes!!

CCarreiras

EESignature

0 Likes
Message 3 of 4

Anonymous
Not applicable
Can you help me with the code ?
0 Likes
Message 4 of 4

Anonymous
Not applicable

 

Can someone help me with the code to include the "square" block ?

I can get the name "square" but dont know how to include it to my 200.ipt

 

derive include.jpg

 

Public Sub mDerived_block()

    Dim oPartDoc As PartDocument
        Set oPartDoc = ThisApplication.ActiveDocument
   
    Dim oderivedPart As DerivedPartComponent
    Set oderivedPart = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Item(1)
   
    Dim oRefPart As PartDocument
    Set oRefPart = oderivedPart.ReferencedDocumentDescriptor.ReferencedDocument
     Debug.Print (oRefPart.DisplayName)
    
    Dim oRefPartDef As PartComponentDefinition
    Set oRefPartDef = oRefPart.ComponentDefinition
           
    Dim oSketchBlockDef As SketchBlockDefinition
    Set oSketchBlockDef = oRefPartDef.SketchBlockDefinitions.Item(1)

    Debug.Print (oSketchBlockDef.Name)
    End Sub

0 Likes