mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 08:25:19 +01:00
working move body command
This commit is contained in:
parent
96911f2bdf
commit
0cba47e251
1 changed files with 18 additions and 25 deletions
|
|
@ -10,6 +10,7 @@ interface MoveBodyParams {
|
|||
toLocation: MDatum;
|
||||
fromLocation: MDatum;
|
||||
body: MShell;
|
||||
featureId;
|
||||
}
|
||||
|
||||
export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
||||
|
|
@ -30,36 +31,27 @@ export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
|||
created: []
|
||||
};
|
||||
|
||||
const bodyLocation = params.body.csys;
|
||||
const fromLocation = params.fromLocation.csys;
|
||||
console.log("from location", params.fromLocation)
|
||||
|
||||
const toLocation = params.toLocation.csys;
|
||||
|
||||
let location = bodyLocation.outTransformation._normalize();
|
||||
const bodyLocation = params.body.csys;
|
||||
let location = bodyLocation.outTransformation; //._normalize();
|
||||
|
||||
|
||||
// location = location.combine(
|
||||
// fromLocation.outTransformation.combine(toLocation.inTransformation._normalize())
|
||||
// )._normalize();
|
||||
if (params.fromLocation) {
|
||||
//Set position of object using a fromLocation and toLocation
|
||||
const fromLocation = params.fromLocation.csys;
|
||||
|
||||
location = location.combine(toLocation.outTransformation._normalize().combine(fromLocation.outTransformation._normalize()));
|
||||
//location = location.combine(bodyLocation.inTransformation);
|
||||
location = location.combine(
|
||||
toLocation.outTransformation._normalize().combine(fromLocation.inTransformation._normalize())
|
||||
);
|
||||
|
||||
//let location =fromLocation.outTransformation.combine(toLocation.outTransformation);
|
||||
//location = location.combine(toLocation.outTransformation._normalize())._normalize();
|
||||
} else {
|
||||
//just set a new posistion on the body.
|
||||
location = location.combine(toLocation.outTransformation);
|
||||
}
|
||||
|
||||
//const location = params.toLocation.csys.outTransformation._normalize();
|
||||
|
||||
//const Newlocation = toLocation.outTransformation.combine(fromLocation.inTransformation._normalize())._normalize();
|
||||
//const Newlocation = fromLocation.inTransformation.combine(toLocation.outTransformation);
|
||||
//const Newlocation = toLocation.outTransformation.combine(fromLocation.outTransformation)._normalize();
|
||||
|
||||
//let location = params.body.csys.outTransformation.combine(fromLocation.outTransformation._normalize())._normalize();
|
||||
//location = location.combine(Newlocation)._normalize();
|
||||
|
||||
//location =Newlocation;
|
||||
|
||||
|
||||
const newShellName = params.body.id + ":T";
|
||||
const newShellName = params.body.id + ":T"+ params.featureId;
|
||||
|
||||
oci.copy(params.body, newShellName);
|
||||
|
||||
|
|
@ -90,9 +82,10 @@ export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
|||
capture: [EntityKind.DATUM],
|
||||
label: 'From Location',
|
||||
multi: false,
|
||||
optional: true,
|
||||
defaultValue: {
|
||||
usePreselection: true,
|
||||
preselectionIndex: 0
|
||||
preselectionIndex: 1
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue