Hello,
I have problem with creating smartsolid by boolean operation.
After creating element by SmartSolid.SolidUnion it became scaled down 1000 times.
Strange thing is that it happens only if I run function from Microstation Interface (i.e. key in command "vba run [Default]modTest.TestCreate"). When I run it from vba window everything creates fine.
It happens no matter what units are set in the design file.
I'm using Microstation V8i (SELECTseries 4) Version 08.11.09.829
Here's the sample code I use:
Sub TestCreate() Dim oCell As CellElement Set oCell = CreateTeeCell(Point3dFromXYZ(100, 100, 100), 74, 74, 74, 37.5, 37.5) ActiveModelReference.AddElement oCell End Sub Function CreateTeeCell(origin As Point3d, length1 As Double, length2 As Double, length3 As Double, _ diameter1 As Double, diameter2 As Double, Optional axis As Boolean = False) As CellElement Dim oCell As CellElement Dim oTee As SmartSolidElement Dim oSSCylinder1 As SmartSolidElement Dim oSSCylinder2 As SmartSolidElement Dim oElements() As Element Dim cellName As String ReDim oElements(2) Set oSSCylinder1 = SmartSolid.CreateCylinder(Nothing, diameter1, length1 * 2) Set oSSCylinder2 = SmartSolid.CreateCylinder(Nothing, diameter2, length2) oSSCylinder1.Rotate Point3dZero, Radians(270), 0, 0 oSSCylinder1.Rotate Point3dZero, 0, 0, Radians(90) oSSCylinder1.Move Point3dFromXYZ(length1, 0, 0) oSSCylinder2.Rotate Point3dZero, Radians(270), 0, 0 oSSCylinder2.Move Point3dFromXYZ(length1, length2 / 2, 0) cellName = "TEST" ActiveModelReference.AddElement oSSCylinder1 ActiveModelReference.AddElement oSSCylinder2 Set oTee = SmartSolid.SolidUnion(oSSCylinder1, oSSCylinder2) ActiveModelReference.AddElement oTee Set oElements(0) = oTee Set oElements(1) = CreateLineElement2(Nothing, Point3dZero, Point3dFromXYZ(length1 * 2, 0, 0)) Set oElements(2) = CreateLineElement2(Nothing, Point3dFromXYZ(length1, 0, 0), Point3dFromXYZ(length1, length2, 0)) Set oCell = CreateCellElement1(cellName, oElements, Point3dZero, False) oCell.Move origin Set CreateTeeCell = oCell End Function
Here's also link to the exact file I tested it on.
test.dgn
Here's result of geometry creation:
as you can see, lines present desired dimensions of geometry and small point inside is geometry created by union operation
I have absolutly no idea, why smartsolid geometry is being scaled. I hope someone could help me with this issue.
Best regards
RG
Hello Ryszard,
I checked this in V8i and CONNECT…working fine in CONNECT Edition but not in V8i.
Creates incorrect Geometry while executing following Lines from the macro in V8i
Set oTee = SmartSolid.SolidUnion(oSSCylinder1, oSSCylinder2)
ActiveModelReference.AddElement oTee
Hello Dinesh,
Yes that's exactly the source of problem. I assume that is some kind of application error and it will be not corrected because there is a newer Connect version of Microstation. Unfortunately Connect edition has very poor performance in comparison with v8i so we still work on v8i. Anyway thanks for your reply.
Best regards,