From Vectorworks Developer
Jump to: navigation, search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference


namespace VectorWorks

Member of VCOM:VectorWorks:ISDK

Returns a handle to an array of WorldPt which holds all of the intersection points between the two objects. The returned intersection handle must be disposed after using.

virtual MCObjectHandle IntersectObjects(
MCObjectHandle obj1,
MCObjectHandle obj2,
bool onlyOnObjs)


MCObjectHandle obj1 No information available.
MCObjectHandle obj2 No information available.
bool onlyOnObjs See remarks.

Return Value

On error returns: nil


bool onlyOnObjs:
  • If true:
    • When no intersection takes place, returns an empty array.
    • When intersection, returns an array with the intersection points.
  • If false:
    • When no intersection takes place, returns an array with the points of the two objects.
    • When intersection, returns an array with the intersection points and the bounding box of the two objects.

You can't use these points to draw the intersection object:

  • The returned list of points is in a free order.
  • When intersecting curved objects (circles, polylines,...) it seems not possible to find out what sides are curved.


// Create 2 rectangles that will intersect at {50,100}, {100,100}, {50,50}, {100,50}.
MCObjectHandle obj1 = gSDK->CreateRectangle(WorldRect(0, 50, 150, 0));
MCObjectHandle obj2 = gSDK->CreateRectangle(WorldRect(50, 150, 100, 0));

// All the intersection pts will be stored in a handle.
MCObjectHandle intersectPtArray = gSDK->IntersectObjects(obj1, obj2, true);
if (intersectPtArray != nullptr)
	size_t sizeHandle;
	gSDK->GSGetHandleSize(intersectPtArray, sizeHandle);
	size_t sizeWorldPt = sizeof WorldPt;

	size_t numWorldPt = sizeHandle / sizeWorldPt;

	WorldPt* intersectPtPtr = (WorldPt*) * intersectPtArray; 

	// Save the point in a list for later use.
	std::vector listWP;
	for (size_t i = 0; i < numWorldPt; i++)
		WorldPt point = * intersectPtPtr; 
		intersectPtPtr ++;
	// Here you can use the points, saved in the list.


Availability: from Vectorworks 2009
Personal tools

Advanced Search
See Also