Gostaria de ajuda para, com comandos ecmascripts via Shell scripts executar o que descrevo abaixo:
a)Tendo varias entidades desenhadas, geradas inclusive atraves de comandos ecmascripts: selecionar todas e
b)numa segunda ação, girá-las através de um ponto específico de giro( por exemplo ponto de coordenadas 20,35), um determinado angulo de rotação, por exemplo 46º.
c)E numa terceira ação, deslocar todo o conjunto selecionado um dado valor no eixo x e outro valor no eixo y.
Lembrando que como usarei estes exemplos em muitas outras ocasiões, gostaria que a informação fosse passada, se possivel, de forma a que possa ser utilizada de forma separada. Ou seja, ora selecionando e girando, e outra selecionado e deslocando.
Tenho as informações do arquivo SelectAll.js, por exemplo, mas não consigo abstrair dele esta funcionalidade.
Poderiam me ajudar?
Selecionar e girar, e selecioanar e deslocar.
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Re: Selecionar e girar, e selecioanar e deslocar.
To get the document and document interface (di) from your script action:
Or from the script console:
To select all:
Rotate selection:
Move selection:
Same as rotate but with:
Code: Select all
document = this.getDocument();
di = this.getDocumentInterface();
Code: Select all
document = getDocument();
di = getDocumentInterface();
To select all:
Code: Select all
di.selectAll();
Code: Select all
var ids = document.querySelectedEntities();
var op = new RModifyObjectsOperation();
for (var i=0; i<ids.length; i++) {
var id = ids[i];
var entity = document.queryEntity(id);
// rotate by 30 degrees around 10/10:
entity.rotate(30.0, new RVector(10,10));
op.addObject(entity, false);
}
di.applyOperation(op);
Same as rotate but with:
Code: Select all
// move in X by 10, in Y by 20 units:
entity.move(new RVector(10,20));
Re: Selecionar e girar, e selecioanar e deslocar.
Mais uma vez, obrigado a todos pela ajuda. Funcionou perfeitamente. Agora, aos poucos, estou colocando o projeto em prática e ganhando um pouquinho de experiência com a linguagem.
Re: Selecionar e girar, e selecioanar e deslocar.
Happy for you.
Where all this Pre-Sales Question.
Or are you a already a user with a question.
I would post questions as yours in sections:
Private interest:
QCAD Troubleshooting and Problems
Shared app:
QCAD Developers and Contributors
Sorry for the English,
Sheers,
CVH
Where all this Pre-Sales Question.
Or are you a already a user with a question.
I would post questions as yours in sections:
Private interest:
QCAD Troubleshooting and Problems
Shared app:
QCAD Developers and Contributors
Sorry for the English,
Sheers,
CVH