How redefine a workplane via API

How redefine a workplane via API

Anonymous
Not applicable
370 Views
1 Reply
Message 1 of 2

How redefine a workplane via API

Anonymous
Not applicable

I need a help!

Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click

Dim oDoc As PartDocument
oDoc = _invApp.ActiveDocument

'获取当前文档存在的工作平面
Dim partDef As PartComponentDefinition
partDef = oDoc.ComponentDefinition


Dim oWP1 As WorkPlane
oWP1 = partDef.WorkPlanes.Item("工作平面1507.5m")


Dim oTransGeom As TransientGeometry
oTransGeom = _invApp.TransientGeometry


Dim p1, p2, p3 As WorkPoint
p1 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(0, 0, 0))
p2 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(100, 0, 0))
p3 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(0, 100, 0))
oWP1.SetByThreePoints(p1, p2, p3)
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click

Dim oDoc As PartDocument
oDoc = _invApp.ActiveDocument

'获取当前文档存在的工作平面
Dim partDef As PartComponentDefinition
partDef = oDoc.ComponentDefinition

Dim oWP1 As WorkPlane
oWP1 = partDef.WorkPlanes.Item("工作平面1507.5m")

Dim oTransGeom As TransientGeometry
oTransGeom = _invApp.TransientGeometry

Dim p1, p2, p3 As WorkPoint
p1 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(0, 0, 0))
p2 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(100, 0, 0))
p3 = partDef.WorkPoints.AddFixed(oTransGeom.CreatePoint(0, 100, 0))


oWP1.SetByThreePoints(p1, p2, p3)    'redefine the workplane  by three points

End Sub

 

like this,but it can not run!

3BC9B697-AE9F-451c-95DA-4096AB8CCBDF.png

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

FINET_Laurent
Advisor
Advisor

Hi,

 

Please have a look : https://forums.autodesk.com/t5/inventor-customization/redefining-sketch-features-with-ilogic/td-p/84...

 

Regards,

 

FINET L.

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

0 Likes