VBA Macro translate

VBA Macro translate

Anonymous
Not applicable
350 Views
1 Reply
Message 1 of 2

VBA Macro translate

Anonymous
Not applicable

I would want to translate this code from Ilogic to VBA macro. Is there a kind soul who would help me with this code??

 

Sub Main()

oDoc = ThisApplication.ActiveDocument
Dim oSelectSet As SelectSet
oSelectSet = oDoc.SelectSet

oSelectSet.Clear
osketch=ThisApplication.ActiveEditObject

If osketch.type=83924736 Then

    If osketch.sketchblocks.count=0 Then
        Exit Sub
    End If
    
    oSelectSet.select(osketch.sketchblocks.Item(SharedVariable("i")))
    SharedVariable("i")=SharedVariable("i")+1
    
ElseIf osketch.type=84006912 Then

    If osketch.ChildBlocks.count=0 Then
        Exit Sub
    End If
    
    If SharedVariable("i")>osketch.ChildBlocks.count Then
    SharedVariable("i")=1
    End If
    oSelectSet.select(osketch.ChildBlocks.Item(SharedVariable("i")))
    SharedVariable("i")=SharedVariable("i")+1
End If
End Sub

 

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

bradeneuropeArthur
Mentor
Mentor
Sub Main()
dim oDoc as PartDocument
set oDoc = ThisApplication.ActiveDocument
Dim oSelectSet As SelectSet
Set oSelectSet = oDoc.SelectSet

oSelectSet.Clear
osketch = ThisApplication.ActiveEditObject

If osketch.Type = 83924736 Then

    If osketch.SketchBlocks.Count = 0 Then
        Exit Sub
    End If
    
    oSelectSet.Select (osketch.SketchBlocks.Item(SharedVariable("i")))
    SharedVariable("i") = SharedVariable("i") + 1
    
ElseIf osketch.Type = 84006912 Then

    If osketch.ChildBlocks.Count = 0 Then
        Exit Sub
    End If
    
    If SharedVariable("i") > osketch.ChildBlocks.Count Then
    SharedVariable("i") = 1
    End If
    oSelectSet.Select (osketch.ChildBlocks.Item(SharedVariable("i")))
    SharedVariable("i") = SharedVariable("i") + 1
End If
End Sub

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature