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

Bug in Compound location handling #811

Open
MatthiasJ1 opened this issue Dec 9, 2024 · 2 comments
Open

Bug in Compound location handling #811

MatthiasJ1 opened this issue Dec 9, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MatthiasJ1
Copy link
Contributor

MatthiasJ1 commented Dec 9, 2024

a = GridLocations(60, 30, 2, 2) * extrude(Rectangle(50, 20), -5)
b = pack([Compound(children=[a[0]]), *a[1:]], 1)
Screenshot

If you fuse b as is, it will be fixed afterwards which shows this is not a bug in pack.

@gumyr gumyr added the bug Something isn't working label Jan 2, 2025
@gumyr gumyr added this to the Gating Release 1.0.0 milestone Jan 2, 2025
@gumyr
Copy link
Owner

gumyr commented Jan 2, 2025

Note for self - here is a hypothesis on what might be happening:

There were changes in the code in November that eliminated "needless" Compound wrappers around objects - a common occurrence with OCCT operations - where "needless" is defined as a Compound that has only one member. In this case the singleton Compound has a non zero Location so stripping that off changes where the enclosed shape is ultimately located.

If this is the problem then this "unwrapping" procedure needs to re-locate the enclosed shape.

@gumyr
Copy link
Owner

gumyr commented Jan 2, 2025

Maybe not:

box = Compound(children=[Solid.make_box(1, 1, 1)]).locate(Pos((2, 0, 0)))
assembly = Compound(children=[box]).moved(Pos((0, 2)))
print(assembly.show_topology("Solid"))

unwrapped = unwrap_topods_compound(assembly.wrapped)
print(unwrapped, Location(unwrapped.Location()))
             Compound at 0x7b341b3a2a40, Location(p=(0.00, 2.00, 0.00), o=(-0.00, 0.00, -0.00))
└──          Compound at 0x7b341a5abdc0, Location(p=(2.00, 0.00, 0.00), o=(-0.00, 0.00, -0.00))
    └──      Solid    at 0x7b341a5abe20, Location(p=(0.00, 0.00, 0.00), o=(-0.00, 0.00, -0.00))

<OCP.TopoDS.TopoDS_Solid object at 0x7b341a5ded70> Location: (position=(2.00, 2.00, 0.00), orientation=(-0.00, 0.00, -0.00))

The resulting Solid is in the correct Location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants