Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
pveng
244 Views, 2 Replies

Transient cylinder

Hello all,

 

I need a segment of a transient cylinder.

The parameters in cylindrical coordinate system are: r1, r2, y1, y2, phi1, phi2.

I have the problem to define the angles phi1 and phi2.

Unfortunately the function 'oTransientBRep.CreateSolidCylinderCone' only uses r and y as parameters. One can only build full cylinders with this function. 

I tried to split up the cylinder with a plane at the required angle, but this doesn't work.

 

This is my code:

 

Public Sub CreateSegmentCylinder()

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition

 

Dim otg As TransientGeometry
Set otg = ThisApplication.TransientGeometry
Dim oTransientBRep As TransientBRep
Set oTransientBRep = ThisApplication.TransientBRep

Dim r1, r2, y1, y2, phi1, phi2 As Double
r1 = 1
r2 = 2
y1 = 0
y2 = 1
phi1 = 0
phi2 = 20

 

Dim p1 As Point
Set p1 = otg.CreatePoint(0, y1, 0)
Dim p2 As Point
Set p2 = otg.CreatePoint(0, y2, 0)

Dim oCylinder1 As SurfaceBody
Set oCylinder1 = oTransientBRep.CreateSolidCylinderCone(p1, p2, r1, r1, r1)

Dim oCylinder2 As SurfaceBody
Set oCylinder2 = oTransientBRep.CreateSolidCylinderCone(p1, p2, r2, r2, r2)

 

' Cut oCylinder2 with oCylinder1
Call oTransientBRep.DoBoolean(oCylinder2, oCylinder1, kBooleanTypeDifference)

Dim p3 As Point
Set p3 = otg.CreatePoint(Cos(phi1 / 180 * pi), y1, Sin(phi1 / 180 * pi))
Dim oplane As plane
Set oplane = otg.CreatePlaneByThreePoints(p1, p2, p3)

' How can the transient cylinder split with the plane?
'Call oCompDef.Features.SplitFeatures.SplitBody(oplane, oCylinder2)

' Create a base feature with the result body.
Dim oBaseFeature As NonParametricBaseFeature
Set oBaseFeature = oCompDef.Features.NonParametricBaseFeatures.Add(oCylinder2)
End Sub

 

Thanks for your help