mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 15:44:12 -06:00
1st installment of 3d offset for ModelInstance
This commit is contained in:
parent
bef19fe6da
commit
af19713a27
16 changed files with 400 additions and 7 deletions
|
@ -517,8 +517,17 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) {
|
|||
if(item.vertexCount() > 3) {
|
||||
item.rotation(objinst->rotation);
|
||||
item.translation( {
|
||||
//################################################################################################################################
|
||||
#if ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
ClipperLib::cInt(objinst->get_offset(X) / SCALING_FACTOR),
|
||||
ClipperLib::cInt(objinst->get_offset(Y) / SCALING_FACTOR)
|
||||
#else
|
||||
//################################################################################################################################
|
||||
ClipperLib::cInt(objinst->offset(0)/SCALING_FACTOR),
|
||||
ClipperLib::cInt(objinst->offset(1)/SCALING_FACTOR)
|
||||
//################################################################################################################################
|
||||
#endif // ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
//################################################################################################################################
|
||||
});
|
||||
ret.emplace_back(objinst, item);
|
||||
}
|
||||
|
@ -655,11 +664,27 @@ void applyResult(
|
|||
// appropriately
|
||||
auto off = item.translation();
|
||||
Radians rot = item.rotation();
|
||||
//################################################################################################################################
|
||||
#if ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
Vec3d foff(off.X*SCALING_FACTOR + batch_offset, off.Y*SCALING_FACTOR, 0.0);
|
||||
#else
|
||||
//################################################################################################################################
|
||||
Vec2d foff(off.X*SCALING_FACTOR + batch_offset, off.Y*SCALING_FACTOR);
|
||||
//################################################################################################################################
|
||||
#endif // ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
//################################################################################################################################
|
||||
|
||||
// write the tranformation data into the model instance
|
||||
inst_ptr->rotation = rot;
|
||||
//################################################################################################################################
|
||||
#if ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
inst_ptr->set_offset(foff);
|
||||
#else
|
||||
//################################################################################################################################
|
||||
inst_ptr->offset = foff;
|
||||
//################################################################################################################################
|
||||
#endif // ENABLE_MODELINSTANCE_3D_OFFSET
|
||||
//################################################################################################################################
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue