Page 9 of 9

Re: model railroad track planning

Posted: Sat Jan 21, 2017 4:34 am
by Husky
smf wrote:I'm still playing around with QCad and QCTrack, but it "just works", so there was no need for an update.
Hi smf - glad to hear that! I updated your library file list. :wink:

Re: model railroad track planning

Posted: Mon Feb 11, 2019 8:40 pm
by smf
Hi there,

somewhere before QCad 3.21 there were some changes that I completely missed. Sorry! :oops: So the version 101 of QCTrack does not work with the current version of QCad. After massive help of Andrew (thank you!) I will upload an updated QCTrack version for the next official QCad version as soon as possible.

Regards - smf

Re: model railroad track planning

Posted: Sat Apr 27, 2019 2:36 pm
by smf
Hi there,

sorry for the long offline-time (read: family-time). Attached is the new QCTrack version 102 which is tested with QCad 3.22.0 and seems :wink: to work. If you have any problems, please report them here.

@Husky: if you're still here, please update the "newest version" thread. Thank you! :D

@Andrew: thank you for your help and special QCad-extension! :) :) :)

Best regards
smf

Re: model railroad track planning

Posted: Sun Apr 28, 2019 9:40 am
by Husky
Done! :wink:

Re: model railroad track planning

Posted: Wed Jul 26, 2023 7:47 am
by smf
Unfortunatly, QCTrack is broken starting with QCad 3.24.0 onwards. Maybe there were some changes to the API of line-block-positions which I am not able to nail down or fix at the moment. I'm sorry and can not foresee when QCTrack will be fixed.

Re: model railroad track planning

Posted: Wed Jul 26, 2023 11:40 am
by andrew
Can you try this change in function getClosestTrackEnd in QCTrack.js:

var line = data.queryEntity(subIds[k], true);

The true argument means that the returned entity will be transformed according to block transformations. The default is false.

The same change is likely needed in getClosestTrackStraightMid.

Re: model railroad track planning

Posted: Thu Jul 27, 2023 7:11 am
by smf
Thank you for your fast response, indeed the added true-parameter fixes adding new tracks. :) I looked for other occurences and tried to add this parameter, but sometimes the complete library is broken, sometimes only parts of it work. It will take some time to test each occurence, but now I have a plan. Thanks again! :D

Re: model railroad track planning

Posted: Thu Jul 27, 2023 12:40 pm
by smf
Most things seem to work now, one thing to do is getting "selected" property of a line of a block depending on the selection of the block. Until 3.23 I did something like:

Code: Select all

  var k, subIds = document.queryBlockEntities(data.getReferencedBlockId());
  for (k = 0; k < subIds.length; k++) {
    var line = data.queryEntity(subIds[k]); //starting with 3.24, add "true" parameter to get absolute coordinates instead of block coordinates
    if (!line.isSelected()) { ... } //always returns false starting with 3.24 <<< how to do now?
Maybe there is a more elegant way to get only entities of selecteded blocks, or what would be the preferred way to get the "selected" property?

Thanks in advance!

Re: model railroad track planning

Posted: Thu Jul 27, 2023 1:12 pm
by andrew
It's the block reference that is selected, not the individual entities inside the block definition.

You'd have to query the selection status of the block reference. In your function that is: block.isSelected().

Re: model railroad track planning

Posted: Thu Jul 27, 2023 1:19 pm
by smf
Thanks, that's it! Leaving me with the question, why I did not do this before - it is more elegant, a lot faster... e_confused

Re: model railroad track planning

Posted: Thu Jul 27, 2023 2:40 pm
by smf
Hi there,

thanks to Andrew's help, attached is the new QCTrack version 103 which is tested with QCad 3.24.0 / 3.27.6 / 3.28.1 and seems :wink: to work. If you have any problems, please report them here.

@Husky: if you're still here, please update the "newest version" thread. Thank you! :D

Best regards
smf