Redefine First Sketch of Part

Redefine First Sketch of Part

Anonymous
Not applicable
286 Views
2 Replies
Message 1 of 3

Redefine First Sketch of Part

Anonymous
Not applicable
Hello, is there any VBA to redefine first sketch of any part (eg. from XY plane into XZ or YZ plane)?

Thanks in advance,
Patrick
0 Likes
287 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Here it goes...

Sub RedefineSketch()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition

' Get the first sketch in the document
Dim oSketch As PlanarSketch
Set oSketch = oDef.Sketches.Item(1)

' Get the YZ workplane (always the first item in the collection)
Dim oYZPlane As WorkPlane
Set oYZPlane = oDef.WorkPlanes.Item(1)

' Redefine the sketch to be based on YZ plane
oSketch.PlanarEntity = oYZPlane

End Sub

Sanjay-

wrote in message news:5796199@discussion.autodesk.com...
Hello, is there any VBA to redefine first sketch of any part (eg. from XY
plane into XZ or YZ plane)?

Thanks in advance,
Patrick
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hi Sanjay,

Thanks for your prompt reply.

Regards,
Patrick
0 Likes