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

EntityContainer allows access to objects of other EntityContainers #31

Open
4 tasks done
wtertinek opened this issue Jan 3, 2023 · 0 comments
Open
4 tasks done
Labels

Comments

@wtertinek
Copy link
Owner

wtertinek commented Jan 3, 2023

Expected Behavior

I'm expecting EntityContainer.Element(ObjectId) and EntityContainer.ElementOrDefault(ObjectId) to return only Entities that are children of the container.

Current Behavior

Currently it is possible to get an Entity that is present on a PaperSpace layout via the ModelSpace (see sample code below).

Context

  • Linq2Acad Version: 1.0.0
  • AutoCAD Version: 2022

Failure Information

The failure does not produce an error in the AutoCAD API. It is just a wrong behavior of Linq2Acad.

Sample Code

using (var db = AcadDatabase.Active())
{
  // We expect to have an Entity in the paper space
  var paperSpaceEntity = db.PaperSpace.First().First();

  var _ = db.ModelSpace.Element(paperSpaceEntity.ObjectId);
  System.Diagnostics.Debug.Fail("No exception thrown");
  // The above call should actually throw an exception because paperSpaceEntity is not present in the model space

  var result = db.ModelSpace.ElementOrDefault(paperSpaceEntity.ObjectId);
  System.Diagnostics.Debug.Assert(result == null);
  // result should actually be null because paperSpaceEntity is not present in the model space
}

Checklist

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I have provided sufficient information for the team
@wtertinek wtertinek added the bug label Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant