Re: Criar linhas ou arcos via ecmascrits, sem o uso do "simple.js"
Posted: Thu Jan 09, 2020 3:32 am
Tentei executar como sugerido mas deu o erro reportado através da figura abaixo
https://www.ribbonsoft.com/rsforum/
Code: Select all
include('scripts\ShapeAlgorithms.js')
var doc = getDocument();
var di = getDocumentInterface();
var operation = new RAddObjectsOperation();
operation.setText("Adding Arc3P");
var point1 = new RVector(50,50);
var point2 = new RVector(75,100);
var point3 = new RVector(100,50);
var shape = ShapeAlgorithms.createArcFrom3Points(point1, point2, point3);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// shape is not always an Arc, it can be a Line too.
// or non valid, or undefined, .... but I know this one will be valid
// see: Arc3P.js ... Arc3P.getOperation
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
var newEntity = new RArcEntity(doc, new RArcData(shape));
operation.addObject(newEntity);
di.applyOperation(operation);
Code: Select all
include('scripts\ShapeAlgorithms.js')
var doc = getDocument();
var di = getDocumentInterface();
var operation = new RAddObjectsOperation();
operation.setText("Adding some Arc3P");
var point1 = new RVector(50,50);
var point3 = new RVector(100,50);
var point2, shape;
for (var k=0; k<5; k++) {
point2 = new RVector(75,100+5*k);
shape = ShapeAlgorithms.createArcFrom3Points(point1, point2, point3);
var newEntity = new RArcEntity(doc, new RArcData(shape));
operation.addObject(newEntity);
}
di.applyOperation(operation);