question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Separate Component from world_coords

See original GitHub issue

Should parts have a separate class instance for its world presence?

Current Implementation

>>> from cqparts_misc.basic.primatives import Cube
>>> from cqparts.utils import CoordSystem

>>> cube = Cube()
>>> cube.local_obj  # geometry in the part's native coordinate system

>>> cube.world_coords = CoordSystem((1, 2, 3))
>>> cube.world_obj  # geometry translated by (1, 2, 3)

Potentially changed to

>>> from cqparts_misc.basic.primatives import Cube
>>> from cqparts.utils import CoordSystem
>>> from cqparts import WorldPart

>>> cube = Cube()
>>> cube.obj  # geometry in the part's native coordinate system

>>> world_cube = WorldPart(cube)
>>> world_cube.coord_sys = CoordSystem((1, 2, 3))
>>> world_cube.obj  # geometry translated by (1, 2, 3)

As suggested by @gntech @zwn in https://github.com/fragmuffin/cqparts/issues/97#issuecomment-394616079

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:25 (23 by maintainers)

github_iconTop GitHub Comments

3reactions
zwncommented, Jun 5, 2018

Well, I am thinking about a system where the actual position and orientation of Parts is completely external to them. In such a system the pose of a Part would only be part of its containing Assembly and it would be based on CoordinateSystem of the containing Assembly. Such an Assembly could itself be easily placed within another Assembly just as Part can be. The top level Assembly CoordinateSystem would be the world coordinates. Actually just like a scene graph.

1reaction
fragmuffincommented, Jun 6, 2018

@zignig

if the coordinates inside a assembly are localised, would it mean that the Fasteners and some of the make_alterations would not need the world to local and back again flipping for the calculations

yeah!, I think these calculations would be less fiddly. But only if we have a clean and intuitive way of getting CoordSystem instances from solved assemblies.

I’ve been pondering how to auto explode assemblies, as they get more levels this becomes increasingly important, and it looks so cool. 😉

It would also make exploding a simpler process… one way to do it would be to recursively offset assemblies and parts by a factor along their local Z axis. It would look cool! and I think that’s important… cadquery and cqparts as tools are still being adopted by the larger community, and visual appeal is a big part of that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[MEL] How to get a component pivot world coords?
Hi! Is it possible to get a component pivot world coordinates ( position and rotation) , using MEL?
Read more >
2.1 World Coordinates Support - ESO archive - Eso.org
The world coordinates support in this library based in part on Doug Mink's ... Another class, called WorldCoords , is not based on...
Read more >
javascript - Converting World coordinates to Screen ...
Try with this: var width = 640, height = 480; var widthHalf = width / 2, heightHalf = height / 2; var vector...
Read more >
Coordinates Expressions
The TextureCoordinate expression outputs UV texture coordinates in the form of a two-channel vector value allowing materials to use different UV channels, ...
Read more >
Lecture 12: Camera Projection
Avoid confusion: Pw and Pc are not two different points. They are the same physical point, ... in two different coordinate systems. ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found