Derived sketchblock problem

Derived sketchblock problem

Anonymous
Not applicable
375 Views
1 Reply
Message 1 of 2

Derived sketchblock problem

Anonymous
Not applicable

So the problem is when i change the line from normal to construction line in orignal sketchblock the update doesn't occur in derived sketchblock in a anator part? Is there a way to make this update happen? Ilogic or any posssible trick??

0 Likes
Accepted solutions (1)
376 Views
1 Reply
Reply (1)
Message 2 of 2

HideoYamada
Advisor
Advisor
Accepted solution

Hello vulic,

 

This code (VBA) synchronize that the sketch lines are construction or not.

Only the lines will be synchronized. If you want to synchronize other entities (circle, eclipse, etc...), please add codes.

Sub SynchronizeDerivedSketchBlock()
    Dim oPartDoc As PartDocument: Set oPartDoc = ThisApplication.ActiveDocument
    Dim oPartCompDef As PartComponentDefinition: Set oPartCompDef = oPartDoc.ComponentDefinition
    
    ' For each Derived Part Component...
    Dim oDerivedPartComp As DerivedPartComponent
    For Each oDerivedPartComp In oPartCompDef.ReferenceComponents.DerivedPartComponents
        ' For each Sketch Block Definition...
        Dim oSktBlkDef As SketchBlockDefinition
        For Each oSktBlkDef In oDerivedPartComp.SketchBlockDefinitions
            Dim oOriginalSktBlkDef As SketchBlockDefinition
            Set oOriginalSktBlkDef = oSktBlkDef.ReferencedEntity
            ' For each Sketch Line...
            Dim i As Integer
            For i = 1 To oOriginalSktBlkDef.SketchLines.Count
                oSktBlkDef.SketchLines(i).Construction = oOriginalSktBlkDef.SketchLines(i).Construction
            Next i
        Next oSktBlkDef
    Next oDerivedPartComp
End Sub

And this code must be run by yourself. I think you can rewrite this in iLogic and invoke this method by the event when the document containing derived part component has been changed.

But if set the event to do so, the code runs at every time when the document is changed. This may cause perfomance problem.

 

I hope this post will help you.

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes