Component Copy (CAD Instances)
See original GitHub issueChange directly flows on from discussion: #90 (also relates closely to #96)
The target is for the following code-fragments to evaluate as they’re shown
Implicit Part
behaviour
>>> c1 = Cube(size=10)
>>> c2 = Cube(size=10)
>>> c1.local_obj is c2.local_obj
False
>>> c1 == c2
True
>>> hash(c1) == hash(c2)
True
>>> c1.local_obj = c1.local_obj.faces('>Z').hole(1)
>>> c1 == c2
False
- done
Explicit cqpart.Part
instance
modifier
>>> from copy import copy
>>> c1 = Cube(size=10)
>>> c2 = copy(c1)
>>> c1.local_obj is c2.local_obj
True
>>> c1.local_obj = c1.local_obj.faces('>Z').hole(1)
>>> # OR
>>> #c2.local_obj = c2.local_obj.faces('>Z').hole(1)
>>> c1.local_obj is c2.local_obj
True
- done
>>> c1 = Cube(size=10)
>>> c2 = copy(c1)
>>> c1.world_coords = CoordSystem(origin=(10,0,0))
>>> c2.world_coords = CoordSystem(origin=(-10,0,0))
>>> c1.world_obj = c1.world_obj.faces('>X').hole(1)
>>> c2.world_obj = c2.world_obj.faces('>Y').hole(1)
>>> c1.local_obj is c2.local_obj
True
>>> c1.world_obj is c2.world_obj # would never be True
False
>>> display(c1.local_obj) # cube
>>> display(c2.local_obj) # cube
>>> display(c1.world_obj) # cube with hole along X axis
>>> display(c2.world_obj) # cube with hole along Y axis
- done
Documentation
- review part build cycle docs
- document
copy
behaviour
PR
- ping
@gntech @zignig @dcowden @zwn
for review
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:17 (12 by maintainers)
Top Results From Across the Web
How do I make all the instances of a part in an assembly the ...
Solved: I've created an assembly using the same parts, but added them at different times as I created it. Inventor creates a new...
Read more >Copy and Paste Sketches, Bodies, and Components in Fusion ...
Components can be pasted within the same file as linked instances or new copies. They can also be pasted into another design file...
Read more >Part SimpleCopy - FreeCAD Documentation
Select an object for which you wish to make a copy. Go to the menu Part → Create a copy → Part SimpleCopy.svg...
Read more >Create and insert component instances - Figma Help Center
Create instances · A. Duplicate using the keyboard shortcut. Mac: ⌘ Command D Windows: Ctrl + D · B Drag to copy. Hold...
Read more >Reuse Mates - SOLIDWORKS CAD - GoEngineer Community
You most likely need to use the Copy with Mates option. It's found under the dropdown for insert components. You'll be prompted to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I dont understand the workings of cqparts fully but what would be wrong with this:
What if
c1 = Cube()
only creates the local obj andc1
is then wrapped ina = WorldPart(c1)
class that has the woorld coordinates and makes a world obj from the local obj?b = copy(a)
would have the same reference toc1
but its own world coordinates and own world_obj.Cube()
only creates the actual geometry.WorldPart()
wrapps a geometry and define world coordinates.On second thought, I agree as well, keep it as pythonic as possible