Oops! I guess I should have seen that as a problem.
These line really need to be on the outside of the For Loop.
- Dim btr As BlockTableRecord = trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)For Each vx As Point3d In VertexPts Dim basept As Point3d = vx.TransformBy(mat) Dim pt As Point3d = poly2.GetClosestPointTo(basept, False) Dim v3d As Vector3d = basept.GetVectorTo(pt) Dim derv3d As Vector3d = poly2.GetFirstDerivative(pt) If v3d.IsPerpendicularTo(derv3d) Then Dim ln As Line = New Line(basept, pt) ln.SetDatabaseDefaults() btr.AppendEntity(ln) trans.AddNewlyCreatedDBObject(ln, True) End IfNexttrans.Commit()
It might also make sense to "Dim" all the variable prior to the for loop - just assign them within the loop. |