How to access objects referenced by a CollectionObject?

How to access objects referenced by a CollectionObject?

Anonymous
Not applicable
851 Views
2 Replies
Message 1 of 3

How to access objects referenced by a CollectionObject?

Anonymous
Not applicable

Hi,

 

I'm using the sketch offset method to generate some offset curves which I then copy to another sketch.

 

One I'm done copying the curves to the other sketch I want to delete the offset curves from the original sketch.

 

offsetCurves & curvesForOffset are both CollectionObjects

 

offsetCurves = sketchIn->offset(curvesForOffset, Point3D::create(100,100,0), kerf/2);

sketchIn->copy(offsetCurves, transform, sketchOut);

 

Then to delete the curves, how do I do something like...

 

for (Ptr<Base> object : offsetCurves)

        {

 

             ui->messageBox(object->objectType());

             // Want something like sketchIn->object->deleteMe();

        }

 

As a related question, is it possible to suppress the addition of the offset constraint and sketch dimension when using the sketch->offset method?

 

Thanks!

 

Rod.

0 Likes
Accepted solutions (1)
852 Views
2 Replies
Replies (2)
Message 2 of 3

liujac
Alumni
Alumni
Accepted solution

Hi,

 

You can access the ObjectCollection as below.

	for (Ptr<Base> object : offsetCurves)
	{

		ui->messageBox(object->objectType());
		Ptr<SketchCurve> curve = object;
		if (curve)
			curve->deleteMe();
	}

It’s not possible to suppress the addition of the offset constraint and sketch dimension when using the sketch->offset method. You can get the offset constraints (OffsetConstraint) and sketch dimensions (SketchOffsetCurvesDimension) from offset curves, and then delete them.

 

Thanks,

Jack

Message 3 of 3

Anonymous
Not applicable

Thanks so much Jack!

 

Works perfectly:-)

 

Rod.

0 Likes