Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circular hole UnsplittedOutline is being lost before CompoundShape is returned from CompoundShape.CreateFromList() #194

Open
ChrisClems opened this issue Dec 10, 2024 · 2 comments
Labels
question Further information is requested

Comments

@ChrisClems
Copy link
Contributor

In the attached DXF, when importing and creating a CompoundShape with the CreateFromList method, the UnsplittedOutline property is not making it back to the returned CompoundShape's hole Borders. I've managed to trace it through several methods in the shape building process but so far have been unable to find out where exactly it's being lost.

TestHoles.zip

@dsn27 dsn27 added the question Further information is requested label Dec 11, 2024
@dsn27
Copy link
Collaborator

dsn27 commented Dec 11, 2024

Hi Chris.

It would be really helpfull if you could provide a complete sample that is "ready" to run.

I tried it like this:


private void button1_Click(object sender, EventArgs e)
{
    var m = cadFrame.Project.GetActiveModel();
    var geos = m.AllObjects;
    var cs = CompoundShape.CreateFromList(geos, 0.1, out Plane plane, true);
}

To find out why UnsplittedOutline is null, I have put a break point on the setter of the property.

>	CADability.dll!CADability.Shapes.Border.UnsplittedOutline.set(CADability.Curve2D.ICurve2D value) Line 1179	C#
 	CADability.dll!CADability.Shapes.Border.Segments.set(CADability.Curve2D.ICurve2D[] value) Line 760	C#
 	CADability.dll!CADability.Shapes.Border.Reduce(double prec) Line 1082	C#
 	CADability.dll!CADability.Shapes.SimpleShape.Reduce(double precision) Line 1141	C#
 	CADability.dll!CADability.Shapes.CompoundShape.CreateFromList(CADability.GeoObject.GeoObjectList TheObjects, double maxGap, out CADability.Plane plane, bool partInPart) Line 2109	C#
 	CADability.Forms.dll!CADability.Forms.CadForm.button1_Click(object sender, System.EventArgs e) Line 138	C#
 	[External Code]	
 	CADability.App.exe!CADability.App.Program.Main(string[] args) Line 19	C#

Turns out the Segments are reset by the Reduce function, which in turn sets the UnsplittedOutline to null.

Now we only have to figure out what to do about it. But I don't have an idea right now.

The Property UnsplittedOutline was added by myself as I needed to retain the original objects like circles etc.
A better solution would be to find a way to not call SplitSingleCurve at all and teach the BorderOperation to deal with this.

@ChrisClems
Copy link
Contributor Author

I may be missing something, but do we need to be setting UnsplittedOutline every time the segments are updated at all? If UnsplittedOutline is a preservation of the original geometry, further operations on the segments shouldn't automatically impact the UnsplittedOutline object. If transforms are done on the segments that impact congruence with the original object, then it would be up to the user to also update the UnsplittedOutline property with the same transforms to keep them in sync instead of just erasing the value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants