70000299 Calculating curves of intersecting 3D objects

Article 70000299
Type Wish
Product Engine
Version 7003
Date Added 2/10/2015
Fixed (4/7/2015)
Submitted by Sami Tainio


I was looking for the lines where the triangles of the polyface intersect. For example two spheres have intersection line of a circle. Other entities have IntersectWith method that does this, but not vdPolyface.


In version 7004 we exported a new method on the vdPolyface object like below

summary>Get the intersection gPoints collection where two closed polyfaces intersect.
param name="A">First Polyface
param name="B">Second Polyface
returns>A collection of gPoints that represent the intersection lines of the two polyfaces.
public gPoints[] GetIntersectionPoints(vdPolyface A, vdPolyface B)

This method can be used as following

vdPolyface pface1 = doc.Model.Entities[0] as vdPolyface;
vdPolyface pface2 = doc.Model.Entities[1] as vdPolyface;
vdPolyface newface = new vdPolyface(doc);
gPoints[] pts = newface.GetIntersectionPoints (pface2, pface1);

foreach (gPoints item in pts)
      vdPolyline poly = new vdPolyline(doc, item);
      poly.PenColor.ColorIndex = 1;
      poly.LineWeight = VdConstLineWeight.LW_158;

And in VB
Dim pf1 As VectorDraw_Professional.vdPolyface
Dim pf2 As VectorDraw_Professional.vdPolyface
Dim pf As VectorDraw_Professional.vdPolyface
Dim regions() As gPoints
Dim poly As VectorDraw_Professional.vdPolyline
Dim polyFig As vdrawi5.vdPolyline
Dim document As VectorDraw_Professional.vdDocument
Set document = VDraw1.ActiveDocument.WrapperObject
Set pf1 = document.Model.entities(0)
Set pf2 = document.Model.entities(1)
Set pf = VDraw1.CreateNewVdFigure("vdPolyface").WrapperObject
regions = pf.GetIntersectionPoints(pf1, pf2)
For i = LBound(regions) To UBound(regions)
      Set polyFig = VDraw1.CreateNewVdFigure("vdPolyline")
      Set poly = polyFig.WrapperObject
      poly.VertexList.AddRange regions(i)
      document.Model.entities.AddItem poly
      polyFig.PenColor = 2
      polyFig.LineWeight = LW_158

Send comments on this topic.