LDraw.org Discussion Forums
[LDCad] Rotating Part (not model) on Building Step - Printable Version

+- LDraw.org Discussion Forums (https://forums.ldraw.org)
+-- Forum: LDraw Programs (https://forums.ldraw.org/forum-7.html)
+--- Forum: LDraw Editors and Viewers (https://forums.ldraw.org/forum-11.html)
+--- Thread: [LDCad] Rotating Part (not model) on Building Step (/thread-24207.html)



Rotating Part (not model) on Building Step - Leonardo Gonzalez - 2020-09-11

When creating a building step with LDCad, if you rotate a part (not the whole model) it is rotated for all building steps. Is there a way to make the part rotation unique for a specific building step or from one building step onwards?


RE: Rotating Part (not model) on Building Step - Roland Melkert - 2020-09-11

(2020-09-11, 18:44)Leonardo Gonzalez Wrote: When creating a building step with LDCad, if you rotate a part (not the whole model) it is rotated for all building steps. Is there a way to make the part rotation unique for a specific building step or from one building step onwards?

This is possible using buffer exchange.

It's fairly easy if it only needs a different rotation in the step where it is added.

This is done so:
  • Go to the step where the part is added.
  • Move it to the bottom of the step (in the source window (view/new source window))
  • Also in the source window insert a buffer exchange store meta (Part bin root/special parts/misc non visual ldraw parts) BEFORE the target part
  • Go to the next step.
  • Insert a buffer exchange retrieve meta so it's the first thing in the step. (this will 'delete' your target part)
  • Add an identical part using the different orientation to the same step.
In the source it should look something like this:
Code:
1 14 0 0 0 1 0 0 0 1 0 0 0 1 6141.dat
1 14 0 8 0 1 0 0 0 1 0 0 0 1 6141.dat
0 BUFEXCHG A STORE
1 14 0 -8 0 1 0 0 0 1 0 0 0 1 3024.dat
0 STEP
0 BUFEXCHG A RETRIEVE
1 14 0 -8 0 0.70710678 0 -0.70710678 0 1 0 0.70710678 0 0.70710678 3024.dat



RE: Rotating Part (not model) on Building Step - N. W. Perry - 2020-09-12

To do it from one step onwards, on the other hand, the easiest way is probably to use a submodel. For example, if the part is added in step 10, and then rotated a different way from step 20 onwards, you could put the buffer exchange store command right before the part in step 10 (as described above), then build through step 19. At that point you'd make a submodel copying all the parts added from steps 11-19. Then add step 20, insert the buffer retrieve command (everything after step 10 disappears), and then add the submodel plus the part in its new rotated position.

To me this is the biggest drawback with buffer exchange, the need to add multiple instances of parts that only occur once in the actual model. (I've envisioned a new meta called FLOAT that would not have this problem, but unfortunately I haven't the skills to make it anything more than a vision.) :-)


RE: Rotating Part (not model) on Building Step - Leonardo Gonzalez - 2020-09-14

(2020-09-11, 21:26)Roland Melkert Wrote: This is possible using buffer exchange.

It's fairly easy if it only needs a different rotation in the step where it is added.

This is done so:
  • Go to the step where the part is added.
  • Move it to the bottom of the step (in the source window (view/new source window))
  • Also in the source window insert a buffer exchange store meta (Part bin root/special parts/misc non visual ldraw parts) BEFORE the target part
  • Go to the next step.
  • Insert a buffer exchange retrieve meta so it's the first thing in the step. (this will 'delete' your target part)
  • Add an identical part using the different orientation to the same step.
In the source it should look something like this:
Code:
1 14 0 0 0 1 0 0 0 1 0 0 0 1 6141.dat
1 14 0 8 0 1 0 0 0 1 0 0 0 1 6141.dat
0 BUFEXCHG A STORE
1 14 0 -8 0 1 0 0 0 1 0 0 0 1 3024.dat
0 STEP
0 BUFEXCHG A RETRIEVE
1 14 0 -8 0 0.70710678 0 -0.70710678 0 1 0 0.70710678 0 0.70710678 3024.dat

Thank you for teaching me this, I was wondering what all those "extra" items were for.


(2020-09-12, 0:08)N. W. Perry Wrote: To do it from one step onwards, on the other hand, the easiest way is probably to use a submodel. For example, if the part is added in step 10, and then rotated a different way from step 20 onwards, you could put the buffer exchange store command right before the part in step 10 (as described above), then build through step 19. At that point you'd make a submodel copying all the parts added from steps 11-19. Then add step 20, insert the buffer retrieve command (everything after step 10 disappears), and then add the submodel plus the part in its new rotated position.

To me this is the biggest drawback with buffer exchange, the need to add multiple instances of parts that only occur once in the actual model. (I've envisioned a new meta called FLOAT that would not have this problem, but unfortunately I haven't the skills to make it anything more than a vision.) :-)

Thank you for suggesting the sub-model. I followed Roland's instructions and expanded on it by copying the parts that disappear, just like a sub-model would do.

I do agree with you, on the limitation of the buffer exchange. The current instruction builder that I use Web Lic! does not appear to be compatible with the buffer exchange as it only adds the parts on top of the others without deleting the previous ones, and the part inventory counts all the additional parts included. The buffer exchange methodology seems limited to the LDCad environment.

I assume there is no unique index of the parts in a project, to would allow addressing a particular instance of a given part in order to manipulate its properties. How does the LDCad knows which part are you selecting? Is it only by the placement order in the list?


RE: Rotating Part (not model) on Building Step - N. W. Perry - 2020-09-14

(2020-09-14, 19:20)Leonardo Gonzalez Wrote: Thank you for suggesting the sub-model. I followed Roland's instructions and expanded on it by copying the parts that disappear, just like a sub-model would do.

Yes, you can certainly just copy the parts themselves, if there aren't too many. But when you get to dozens or hundreds, you might want to move them into a subfile just to keep things tidy.

Quote:I do agree with you, on the limitation of the buffer exchange. The current instruction builder that I use Web Lic! does not appear to be compatible with the buffer exchange as it only adds the parts on top of the others without deleting the previous ones, and the part inventory counts all the additional parts included. The buffer exchange methodology seems limited to the LDCad environment.

Originally it was an MLCad meta (and still is). LPub and LDCad both recognize it, but other programs (like LDView) do not.

Quote:I assume there is no unique index of the parts in a project, to would allow addressing a particular instance of a given part in order to manipulate its properties. How does the LDCad knows which part are you selecting? Is it only by the placement order in the list?

I would guess (from my very limited understanding of programming) that it's based on the index position in an array, but I'm sure Roland will chime in with the actual answer. :-)

However, there is already an indexing scheme used in LDCad for groups, where each group is given both a unique global ID and a local ID (so that the same group can be used, for example, inside different submodels). That system could probably be expanded to manipulate individual part properties (as well as those of groups and submodels).


RE: Rotating Part (not model) on Building Step - Roland Melkert - 2020-09-14

(2020-09-14, 19:20)Leonardo Gonzalez Wrote: I assume there is no unique index of the parts in a project, to would allow addressing a particular instance of a given part in order to manipulate its properties. How does the LDCad knows which part are you selecting? Is it only by the placement order in the list?

You can do exactly this using the scripting api, but as soon you leave LDCad you can't assume the index numbers are the same.

This because any third party program (even notepad) could have reorganized the lines.

You could however make an animation of the building process if you prefer that to (lpub) booklets.