mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 21:27:50 -06:00
parent
91a5439f88
commit
4d6528e90d
2 changed files with 25 additions and 14 deletions
|
@ -47,6 +47,7 @@ import sys
|
|||
import os
|
||||
import os.path
|
||||
import numpy
|
||||
import copy
|
||||
numpy.seterr(all="ignore")
|
||||
|
||||
class CuraApplication(QtApplication):
|
||||
|
@ -270,14 +271,22 @@ class CuraApplication(QtApplication):
|
|||
if node:
|
||||
op = GroupedOperation()
|
||||
for i in range(count):
|
||||
new_node = SceneNode()
|
||||
new_node.setMeshData(node.getMeshData())
|
||||
if node.getParent() and node.getParent().callDecoration("isGroup"):
|
||||
new_node = copy.deepcopy(node.getParent()) #Copy the group node.
|
||||
new_node.callDecoration("setConvexHull",None)
|
||||
|
||||
new_node.translate(Vector((i + 1) * node.getBoundingBox().width, node.getPosition().y, 0))
|
||||
new_node.setOrientation(node.getOrientation())
|
||||
new_node.setScale(node.getScale())
|
||||
new_node.setSelectable(True)
|
||||
op.addOperation(AddSceneNodeOperation(new_node, node.getParent()))
|
||||
op.addOperation(AddSceneNodeOperation(new_node,node.getParent().getParent()))
|
||||
|
||||
pass
|
||||
else:
|
||||
new_node = SceneNode()
|
||||
new_node.setMeshData(node.getMeshData())
|
||||
|
||||
new_node.translate(Vector((i + 1) * node.getBoundingBox().width, node.getPosition().y, 0))
|
||||
new_node.setOrientation(node.getOrientation())
|
||||
new_node.setScale(node.getScale())
|
||||
new_node.setSelectable(True)
|
||||
op.addOperation(AddSceneNodeOperation(new_node, node.getParent()))
|
||||
op.push()
|
||||
|
||||
## Center object on platform.
|
||||
|
@ -450,7 +459,8 @@ class CuraApplication(QtApplication):
|
|||
for node in Selection.getAllSelectedObjects():
|
||||
node.setParent(group_node)
|
||||
group_node.setCenterPosition(group_node.getBoundingBox().center)
|
||||
group_node.translate(Vector(0,group_node.getBoundingBox().center.y,0))
|
||||
#group_node.translate(Vector(0,group_node.getBoundingBox().center.y,0))
|
||||
group_node.translate(group_node.getBoundingBox().center)
|
||||
for node in group_node.getChildren():
|
||||
Selection.remove(node)
|
||||
|
||||
|
|
|
@ -98,9 +98,10 @@ class PlatformPhysics:
|
|||
continue
|
||||
|
||||
# Ignore colissions within a group
|
||||
if other_node.getParent().callDecoration("isGroup") is not None:
|
||||
if node.getParent().callDecoration("isGroup") is other_node.getParent().callDecoration("isGroup"):
|
||||
continue
|
||||
if other_node.getParent().callDecoration("isGroup") is not None or node.getParent().callDecoration("isGroup") is not None:
|
||||
continue
|
||||
#if node.getParent().callDecoration("isGroup") is other_node.getParent().callDecoration("isGroup"):
|
||||
# continue
|
||||
|
||||
# Ignore nodes that do not have the right properties set.
|
||||
if not other_node.callDecoration("getConvexHull") or not other_node.getBoundingBox():
|
||||
|
@ -126,9 +127,9 @@ class PlatformPhysics:
|
|||
|
||||
if overlap is None:
|
||||
continue
|
||||
|
||||
move_vector.setX(overlap[0] * 1.1)
|
||||
move_vector.setZ(overlap[1] * 1.1)
|
||||
print(overlap)
|
||||
move_vector.setX(overlap[0] * 1.01)
|
||||
move_vector.setZ(overlap[1] * 1.01)
|
||||
convex_hull = node.callDecoration("getConvexHull")
|
||||
if convex_hull:
|
||||
if not convex_hull.isValid():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue