Transient cylinder

Transient cylinder

pveng
Contributor Contributor
278 Views
2 Replies
Message 1 of 3

Transient cylinder

pveng
Contributor
Contributor

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

0 Likes
279 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

When you try to make a point:

 

Set p3 = otg.CreatePoint(Cos(phi1 / 180 * pi), y1, Sin(phi1 / 180 * pi))

 

in my opinion it doesn't make sense.

You need 3 coordinates set in mm(or inches), but Cos(phi1 / 180 * pi) is an unitless thing. It should be multiplied by some metric value (probably r1 or r2).

 

Could you draw how this cylinder segment should (more ir less) look like?

0 Likes
Message 3 of 3

pveng
Contributor
Contributor

Thanks Thomasz for the quick reply,

 

p3 is only for the plane definition. 3 points define a plane, p1 and p2 are on the y-axis and p3 is away from the y-axis. The distance from the axis isn't needed, only the angle of the plane. For example phi1 = 0 then p3=(1, y1, 0) and therefore the x-y-plane. If phi=90° then p3=(0, y1, 1) and therefore the y-z-plane.

 

The problem is to create a transient geometry like the picture below. As Feature it is not a problem to create, but I need some thousands of this objects, which means, transient geometry is a lot more efficient.

 

pveng_0-1628601197343.png

 

0 Likes