Message 1 of 4
Can't make Plane.IntersectWithPlane work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I can't figure this out, mainly because of the nonspecific error message "the parameter is incorrect". That happens on the last line in this code, but I did find out that the line returned by IntersectWithPlane apparently has a direction of (0, 0, 0). That shouldn't necessarily cause an error when used in CreatePlane, but it doesn't look right. But in any case, no matter what I try I can't get that CreatePlane line to work. I'd appreciate any suggestions.
Dim TG As Inv.TransientGeometry = ThisApplication.TransientGeometry Dim TargPoint As Point TargPoint = TG.CreatePoint(1, 1, 1) Dim StartPoint As Point StartPoint = TG.CreatePoint(2, 2, 1) Dim EndPoint As Point EndPoint = TG.CreatePoint(-1, -1, 1) ' Create the X-Axis vector Dim XYScanPlane As Inv.Plane XYScanPlane = TG.CreatePlaneByThreePoints(TargPoint, StartPoint, EndPoint) Dim X As Double Dim Y As Double Dim Z As Double X = StartPoint.X - TargPoint.X Y = StartPoint.Y - TargPoint.Y Z = StartPoint.Z - TargPoint.Z Dim XAxisVect As Inv.Vector = TG.CreateVector(X, Y, Z) Dim YZScanPlane As Inv.Plane YZScanPlane = TG.CreatePlane(TargPoint, XAxisVect) Dim YAxisLine As Inv.Line YAxisLine = XYScanPlane.IntersectWithPlane(YZScanPlane) ' This is likely the problem Dim RootPoint As Point = YAxisLine.RootPoint Logger.Debug("Root Point: " & RootPoint.X & ", " & RootPoint.Y & ", " & RootPoint.Z & ")") Dim YAxisUnit As Inv.UnitVector = TG.CreateUnitVector YAxisUnit= YAxisLine.Direction() Logger.Debug("Unit: " & YAxisUnit.X & ", " & YAxisUnit.Y & ", " & YAxisUnit.Z) Dim YAxisVect As Inv.Vector = TG.CreateVector(0, 0, 0) YAxisVect = YAxisUnit.AsVector() Logger.Debug("Vect: " & YAxisVect.X & ", " & YAxisVect.Y & ", " & YAxisVect.Z) Dim XZScanPlane As Inv.Plane XZScanPlane = TG.CreatePlane(TargPoint, YAxisVect)