iLogic code to create plane by tangent to a cylinder outerface & parallel to XY plane

iLogic code to create plane by tangent to a cylinder outerface & parallel to XY plane

nsatheesan34D64
Advocate Advocate
489 Views
2 Replies
Message 1 of 3

iLogic code to create plane by tangent to a cylinder outerface & parallel to XY plane

nsatheesan34D64
Advocate
Advocate

Hi all,

 

Is there any iLogic code sample to create a plane, which is tangent to a outside surface of a cylinder and offset to XY plane ? I am trying a project where i need to create a plane tangent to cylinder surface, project the cylinder edges on to newly created plane & create another sketch..  Any help will be much appreciated...  thanks.. !

0 Likes
Accepted solutions (1)
490 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

try this rule. but make sure you test it manual. if you can't do it manually then the rule will crash. while testing I could for example not use the XY plane because it was perpendicular to the cylinder

 

Dim doc As PartDocument = ThisDoc.Document
Dim def As PartComponentDefinition = doc.ComponentDefinition

Dim xyPlane As WorkPlane = def.WorkPlanes.Item("XY Plane")
Dim cilinder As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceCylindricalFilter, "Select a cilinder")

' Input Point object that indicates which of the possible two solutions to use.
' For cylinders and spheres the plane can be on either side of the surface.
' Which solution to use will be determined by which side the proximity point is
' closest to. This point is only used for the initial computation. During a
' recompute the plane will remain on the same side of the tangent surface
' regardless of its position relative to the originally specified point.
Dim point As Point = ThisApplication.TransientGeometry.CreatePoint(0, 0, 0)

def.WorkPlanes.AddByPlaneAndTangent(xyPlane, cilinder, point)

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

nsatheesan34D64
Advocate
Advocate

Hi @JelteDeJong 

 

Thanks a lot. The code works perfectly to create a plane. Can you also help by giving a sample code to project the bottom edges of cylinder & create  a line at middle. Thanks again!

0 Likes