Hi there,
I'm working on scripts to support model railroad track planning. Creating tracks, moving and duplicate-moving are working now thanks to Andrew. Two things are missing and I don't have an idea how to implement them:
1. How do I keep a previous selection after execution of a copying Transform-operation? Use case: select track, dup+move several times. Currently the newly inserted objects are selected but I want to keep the originally selected objects selected.
2. I would like to draw a colored and filled auxiliary circle to mark the source track. I succeeded in creating a circle but not in an eye-catching color or with filled area.
Attached you'll find my current work-in-progress-snapshot containing an example file and the created scripts. These have to reside in ...qcad.../scripts/QCTrack. After insertion into the scripts-directory there will be a new main menu "QCTrack" with three items "Create", "Move" and "Duplicate and move".
Thank you for any comment, hint or help
Best regards
Stefan
script question: keep selection + colored aux entity
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.
script question: keep selection + colored aux entity
- Attachments
-
- QCTrack_V04_DupMoveOk.zip
- scripts
- (9.76 KiB) Downloaded 564 times
-
- eibahntest.dxf
- example file
- (131.33 KiB) Downloaded 560 times
Re: script question: keep selection + colored aux entity
...got the second point somewhat solved with a triangle showing the direction:
ret = new Array();
var mid = getPointOnLine(this.lineSource, 0.5);
ret.push(new RCircle(mid, this.lineSource.getLength() * 1.5));
var top = getPointOnLine(this.lineSource, 2);
var bottom = getPointOnLine(this.lineSource, -1);
var out = getPointOnLine(this.lineSource, 2).rotate(Math.PI / 2, mid);
ret.push(new RLine(top, bottom));
ret.push(new RLine(bottom, out));
ret.push(new RLine(out, top));
ret = new Array();
var mid = getPointOnLine(this.lineSource, 0.5);
ret.push(new RCircle(mid, this.lineSource.getLength() * 1.5));
var top = getPointOnLine(this.lineSource, 2);
var bottom = getPointOnLine(this.lineSource, -1);
var out = getPointOnLine(this.lineSource, 2).rotate(Math.PI / 2, mid);
ret.push(new RLine(top, bottom));
ret.push(new RLine(bottom, out));
ret.push(new RLine(out, top));
keep selection solved?
...now I'm "keeping" the selection by getting all selected entities before operation and resetting selection, because I couldn't find anything better. Attached the current version.
- Attachments
-
- QCTrack_V09_MultiDup.zip
- (10.59 KiB) Downloaded 572 times
Re: keep selection solved?
Hi !smf wrote:...now I'm "keeping" the selection by getting all selected entities before operation and resetting selection, because I couldn't find anything better. Attached the current version.
While looking for Railroad design layout (Marklin HO c-track), found and read your post (nice example) and try to implement it (download your last ver v09 and install it in ...qcad/script/QCTrack), Unfortunately not working - can you help ? is this your last version ?
Thanks.
Re: script question: keep selection + colored aux entity
Hi Itzik,
please try the current version which you find here:
viewtopic.php?f=109&t=3348
Hope this works - you can also get my Maerklin H0-C-track library there!
please try the current version which you find here:
viewtopic.php?f=109&t=3348
Hope this works - you can also get my Maerklin H0-C-track library there!
Re: script question: keep selection + colored aux entity
Hi againsmf wrote:Hi Itzik,
please try the current version which you find here:
viewtopic.php?f=109&t=3348
Hope this works - you can also get my Maerklin H0-C-track library there!
First, Many thanks for the quick response and for the new ver. & tutorial - will be very helpful
will install & try it !
itzik