Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to dim the sketch according a selected line belongs to

Status
Not open for further replies.

Arichzhy

Automotive
Aug 20, 2016
8
CN
before a macro program running, a sketch(different name in different documents,maybe sketch1,sketch2 or sketch3 ) has be opened. I want to do some drawings in the opened sketch, but I don't know how to do next? following is part of my codes:
Sub CATMain()
Dim InputObjectType(0), Status, Selection
Set Selection = CATIA.ActiveDocument.Selection
InputObjectType(0) = "Line2D"
Status = Selection.SelectElement2(InputObjectType, "select a line", True)
If ((Status = "Cancel") Or (Status = "Undo")) Then
MsgBox "case1"
Exit Sub
ElseIf Status = "Redo" Then
Exit Sub
MsgBox "case2"
ElseIf (Status <> "Redo") Then
Set line1 = Selection.Item(1).Value
Dim sketches1 As Sketches
Set sketches1 = CATIA.ActiveDocument.Part.InWorkObject.HybridSketches
????here how to dim the sketch according to the selected line belongs to
...

End If
End Sub

i am newer in macro ,some one can help me? thanks
 
Replies continue below

Recommended for you

record a macro and check the result...

Eric N.
indocti discant et ament meminisse periti
 
Code:
  Dim sketch1 As Sketch
Set sketch1 = line1.Parent.Parent

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top