mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-06 16:33:15 +01:00
non working move body opperation.
This commit is contained in:
parent
1022163889
commit
96911f2bdf
1 changed files with 54 additions and 11 deletions
|
|
@ -7,7 +7,8 @@ import { MShell } from 'cad/model/mshell';
|
||||||
import icon from "./MOVE-BODY.svg";
|
import icon from "./MOVE-BODY.svg";
|
||||||
|
|
||||||
interface MoveBodyParams {
|
interface MoveBodyParams {
|
||||||
datum: MDatum;
|
toLocation: MDatum;
|
||||||
|
fromLocation: MDatum;
|
||||||
body: MShell;
|
body: MShell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -28,12 +29,41 @@ export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
||||||
consumed: [params.body],
|
consumed: [params.body],
|
||||||
created: []
|
created: []
|
||||||
};
|
};
|
||||||
const location = params.datum.csys.outTransformation._normalize();
|
|
||||||
|
const bodyLocation = params.body.csys;
|
||||||
|
const fromLocation = params.fromLocation.csys;
|
||||||
|
const toLocation = params.toLocation.csys;
|
||||||
|
|
||||||
|
let location = bodyLocation.outTransformation._normalize();
|
||||||
|
|
||||||
|
|
||||||
|
// location = location.combine(
|
||||||
|
// fromLocation.outTransformation.combine(toLocation.inTransformation._normalize())
|
||||||
|
// )._normalize();
|
||||||
|
|
||||||
|
location = location.combine(toLocation.outTransformation._normalize().combine(fromLocation.outTransformation._normalize()));
|
||||||
|
//location = location.combine(bodyLocation.inTransformation);
|
||||||
|
|
||||||
|
//let location =fromLocation.outTransformation.combine(toLocation.outTransformation);
|
||||||
|
//location = location.combine(toLocation.outTransformation._normalize())._normalize();
|
||||||
|
|
||||||
|
//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";
|
||||||
|
|
||||||
oci.copy(params.body, newShellName);
|
oci.copy(params.body, newShellName);
|
||||||
|
|
||||||
|
|
||||||
SetLocation(newShellName, location.toFlatArray());
|
SetLocation(newShellName, location.toFlatArray());
|
||||||
returnObject.created.push(occ.io.getShell(newShellName));
|
returnObject.created.push(occ.io.getShell(newShellName));
|
||||||
|
|
||||||
|
|
@ -43,9 +73,22 @@ export const MoveBodyOperation: OperationDescriptor<MoveBodyParams> = {
|
||||||
form: [
|
form: [
|
||||||
{
|
{
|
||||||
type: 'selection',
|
type: 'selection',
|
||||||
name: 'datum',
|
name: 'toLocation',
|
||||||
capture: [EntityKind.DATUM],
|
capture: [EntityKind.DATUM],
|
||||||
label: 'Datum',
|
label: 'To Location',
|
||||||
|
multi: false,
|
||||||
|
defaultValue: {
|
||||||
|
usePreselection: true,
|
||||||
|
preselectionIndex: 0
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
name: 'fromLocation',
|
||||||
|
capture: [EntityKind.DATUM],
|
||||||
|
label: 'From Location',
|
||||||
multi: false,
|
multi: false,
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
usePreselection: true,
|
usePreselection: true,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue