Quantcast
Channel: MicroStation Programming - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 383

Sweeping a circle along a path in MDL

$
0
0

Hello,

I want to make a solid by sweeping a circle along a path(linestring). I tried to use mdlKISolid_sweepBodyWire, but it sometimes fails. (with error code -9074) I thought it was because the circle was not perpendicular to the path, so I tried to make it perpendicular. I couldn't find a function that could do it automatically, so I tried it on my own. I tried to calculate a rotation matrix for the circle so it could be perpendicular to the plane, and it fails sometimes. (The VBA function is at the end.) Is there a better way to do this? When I use "Solid by Extrusion Along" tool in Microstation, there is an option called "Circular" and I can change the "Inside Radius","Outside Radius" from inside Microstation. Is there an mdl function, or an option inside an mdl function, for this specific task? I am doing this in a loop, so it is a bad idea to try to start the tool, set the options and draw it using the tool seperately each time; it decreases performance too much.

Function RotationMatrixFromNormalPoints(p0 As Point3d, p1 As Point3d) As Matrix3d
    Dim normal As Point3d
    normal = Point3dNormalize(Point3dFromXYZ(p1.X - p0.X, p1.Y - p0.Y, p1.z - p0.z))
    Dim tangent0 As Point3d
    tangent0 = Point3dCrossProduct(normal, Point3dFromXYZ(0, 1, 0))  ' I think the problem may be here
    If (Point3dDotProduct(tangent0, tangent0) < 0.0000001) Then
        tangent0 = Point3dCrossProduct(normal, Point3dFromXYZ(1, 0, 0))   'and/or here.  I know it may not be (0,1,0) or (1,0,0). How can I calculate it?
    End If
    tangent0 = Point3dNormalize(tangent0)
    Dim tangent1 As Point3d
    tangent1 = Point3dNormalize(Point3dCrossProduct(normal, tangent0))
    RotationMatrixFromNormalPoints = Matrix3dFromPoint3dColumns(tangent1, tangent0, normal)
End Function

Thanks.


Viewing all articles
Browse latest Browse all 383

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>