728x90
반응형

Dim doc As Document
Dim tgtName As String
Dim refName As String
Dim tgtComp As Component
Dim refComp As Component
Dim dx As Double
Dim dy As Double
Dim rotation As Double

Dim page_count As Double
Dim part_count As Double
Dim input_number As String



Sub Main
Dim ret As Integer

part_count = 0
input_number = InputBox("RefDes : ", "Target") 'ref number Input
    tgtname = "c" + input_number 'Step 1 c part
   
    dx = 0 'x position
    dy = 10.5 'y position
    rotation = 270 'rotation
Call ApplyMove()

tgtname = "c" + CStr(Val(input_number) + 1) 'next part
    dx = 0
    dy = 10.5
    rotation = 270
Call ApplyMove()

    
End Sub

Sub ApplyMove()
    Dim doc     As Document
    Dim tgtComp As Component

    Set doc     = Application.ActiveDocument
    Set tgtComp = doc.Components(tgtName)

    tgtComp.Move dx, dy 'component move
    tgtComp.Orientation = rotation 'coponent rotation
    
    
    MsgBox "[" & tgtName & "] moved by (" & dx & ", " & dy & ")"
End Sub

728x90
반응형

+ Recent posts