Using LDCad flexible parts with Studio


Using LDCad flexible parts with Studio
#1
Studio is a nice LEGO CAD tool, but current version (2.0.1(39)) lacks flexible parts. Fortunately, with some tweaks (and a few caveats), it is possible to use LDCad flexible parts in Studio.

If you created your model with Studio, you need to
  • export it as LDraw
  • open the exported model with LDCad
  • add the flex parts using the guidelines that follow.
  • reload the LDraw model in Studio.
If, like me, you are a die-hard LDCad user, you can still use these tips to make use of the great photorealistic rendering engine included in Studio, or its fast and user friendly instruction generator. I find that Studio editor is not nearly as convenient, flexible and powerful as LDCad, but I'm probably biased Wink

How it works?
LDCad uses specialized meta-commands to describe the flexible parts but also create a generic fallback LDraw representation. It is this fallback which is visible in Studio if two conditions are met:
  • the fallback is made with segment parts present in the LDraw library of Studio
  • The segment parts are not scaled: Studio is not able to scale parts.
Important note:
This is NOT a LDCad flexible parts tutorial! For more details, see LDCad documentation, video tutorials and technical documentation.
Reply
1 - Directly compatible flexible parts
#2
[Image: easy-flex.jpg]
This is the easy case: LDCad fallback representation uses only unscaled LDraw parts. LDCAd model can then simply be loaded in Studio.
This is the case for all chains (Technic and System), System flexible hose and Technic ribbed hose. For this one, you must use the LQ template version (Technic Ribbed Hose LQ). HQ version doesn't use segment parts but a single mesh that can be visually better but doesn't import easily in Studio.
Files: LDraw, Studio
Reply
2 - Flexible parts with scaled segments
#3
[Image: unscaledflex.jpg]

Here LDCad fallback representation uses scaled LDraw segments, so you must tweak flexible parts to force LDCad to use unscaled segments. Otherwise flex parts looks like dashed lines in Studio, like this:
[Image: scaledflex.jpg]

This is the case for all Power Functions and Powered Up elements, as well as pneumatic hoses. You must always use the LQ template version (eg. Power Functions L Motor (LQ), Pneumatic Hose LQ). HQ versions don't use segment parts but a single mesh that can be visually better but don't import easily in Studio.

How to unscale segments:
  • In LDCad nested mode, click on the flexible section of the part to select it, then right-click -> properties
  • Set Basesize=100%, Segment size = 50%, maxmerge = 1 as shown in this screen capture.
[Image: skin1.jpg]

Of course you can also create a Studio compatible LDCad template instead of edit each and every flex part in your model!

I strongly suggest not to edit regular LDCad template, but copy it and edit the template copy. LDCad templates are located in %appdata%\LDCad\templates\ subfolders (Windows).

Here is for example a Studio-compatible pneumatic hose template. To use it place it in the same folder as regular template, in %appdata%\LDCad\templates\path\

Files: LDraw, Studio
Reply
RE: 2 - Flexible parts with scaled segments
#4
Philo,

Could you please copy these information into a wiki tutorial?

w.o
LEGO ergo sum
Reply
RE: 2 - Flexible parts with scaled segments
#6
(2018-11-02, 15:43)Philippe Hurbain Wrote: [Image: scaledflex.jpg]

Is there any similar workaround for using LSynth parts in Studio? I have exactly this issue with the renderer, where the part segments show as disconnected rather than continuous, for the flex system (rigid) hoses. (I'm using Mac, so Bricksmith is my LDraw editor which means LSynth is my option for flexible parts, since Studio's is not usable.)
Reply
3 - Flexible parts that need segment changes
#5
[Image: trickyflex.jpg]

This is the most complex situation: LDCad uses (scaled) segment parts that are not in LDraw library, so you have to find a suitable segment that is in library and modify flex part accordingly.

This is the case for strings, rubber belts, 9V and NXT/EV3 cables, Technic flexible axles and flex-system hoses.

How to change and unscale segments:
  • In LDCad nested mode, click on the flexible section of the part to select it, then right-click -> properties
  • Set Basesize=100%, Segment size = 50%, maxmerge = 1 as shown in this screen capture.
  • Change Donor placement type to Static references and Final scale to Segment merge only
  • Change the Part to the name of LDraw segment file.

[Image: skin2.jpg]

Suggested segment files:
  • 9V cable: 993.dat
  • NXT/EV3 cable: 932.dat
  • flex-system hose: 77.dat
  • round rubber band, strings: 4-4cyli.dat (result is a bit thin, but...)
  • square rubber band: box4o8a.dat
  • Body of Technic flex axle: axlehol8.dat. But you must also provide appropriate segments for the ends, so the best is to use this template!
Two other templates I made: NXT/EV3 cable, string with end studs.

 To use them, place them in the same folder as the matching regular templates, in %appdata%\LDCad\templates\path\

Files: LDraw, Studio

[Image: trickyflexrender.png]
Reply
RE: 3 - Flexible parts that need segment changes
#11
(2018-11-03, 19:44)Philippe Hurbain Wrote: Body of Technic flex axle: axlehol8.dat. But you must also provide appropriate segments for the ends, so the best is to use this template!

Perhaps I should have used your template, Philo…I used the regular LDCad template, but just changing all of the different segments to the appropriate part. (I wanted to use the LDCad template so the path caps would have the proper grouping and snap info.)

Unfortunately, I get some visible gaps in the render—does your template account for this? or is there some setting I can tweak?

   
Reply
RE: 3 - Flexible parts that need segment changes
#12
(2020-03-29, 4:56)N. W. Perry Wrote: Unfortunately, I get some visible gaps in the render—does your template account for this? or is there some setting I can tweak?
Basically for LQ flex parts, the trick is to increase overlap between segments. To do that, lower "Segment size" below 100%. If the visual length of the segment must be preserved (ends of flex axle), increase "Base size" proportionnally.
I tweaked my flex axle template (http://www.brickshelf.com/gallery/Philo/...studio.ldr) because there were gaps in the ends of axles. I changed Segment size to 80% and Base size to 125%, now it looks good:
[Image: flexaxle.png]
Reply
RE: 3 - Flexible parts that need segment changes
#13
(2020-03-29, 11:11)Philippe Hurbain Wrote: Basically for LQ flex parts, the trick is to increase overlap between segments. To do that, lower "Segment size" below 100%. If the visual length of the segment must be preserved (ends of flex axle), increase "Base size" proportionnally.
I tweaked my flex axle template (http://www.brickshelf.com/gallery/Philo/...studio.ldr) because there were gaps in the ends of axles. I changed Segment size to 80% and Base size to 125%, now it looks good:

OK, that's better indeed. (I still have some minuscule seams visible, but I can tell they're due to primitive substitution, not segment overlap, since they're not at the joints between segments.) However, I thought we had to set all basesizes to 100%, because Studio isn't able to scale segments; why does it work in this case?
   
Also…does it look like I have a little gap between the subparts of the path cap (at the "hilt" of the axle end)? I don't think that's just a shadow. Perhaps I'll try the Philo version with the added 77.dat segments…
Reply
RE: 3 - Flexible parts that need segment changes
#14
(2020-03-29, 18:20)N. W. Perry Wrote: However, I thought we had to set all basesizes to 100%, because Studio isn't able to scale segments; why does it work in this case?
Question is not "in this case", it's "now"... this has been corrected some time ago. Still a bit buggy, faked seams are also scaled in renders. This prevents to use large scaling factors.
Reply
RE: 3 - Flexible parts that need segment changes
#15
(2020-03-29, 18:33)Philippe Hurbain Wrote: Question is not "in this case", it's "now"... this has been corrected some time ago. Still a bit buggy, faked seams are also scaled in renders. This prevents to use large scaling factors.

Ah, good—I never realized that had been fixed! So it's still a good idea to change the base size from, say, 400% to 100% (and maxmerge to 1, to avoid super-long straight segments)?

Also, I just figured out that for the flex axle, you don't actually have to change the donor part at all, because all of the LDCad donor parts are just references to regular library parts. You can just select "static references", and then either check "inline donor references", or leave it unchecked and just copy the LDCad donor files into Studio's custom parts directory.
Reply
RE: 3 - Flexible parts that need segment changes
#16
(2020-03-30, 0:42)N. W. Perry Wrote: Ah, good—I never realized that had been fixed! So it's still a good idea to change the base size from, say, 400% to 100% (and maxmerge to 1, to avoid super-long straight segments)?
The idea is to keep scaling factor "low enough" since fake seam sizes are scaled by the same amount. For a plausible gap of 0.25 ldu, a 400% scaling gives a 1 ldu gap, something easily accounted for by segment overlaps. And hopefully this will be corrected. One day. Or another.  Angel

Quote:Also, I just figured out that for the flex axle, you don't actually have to change the donor part at all, because all of the LDCad donor parts are just references to regular library parts. You can just select "static references", and then either check "inline donor references", or leave it unchecked and just copy the LDCad donor files into Studio's custom parts directory.
Yes, that's a possibility. The benefit of using LDraw segments is that they are already in Studio library.
Reply
RE: 3 - Flexible parts that need segment changes
#17
One final (hopefully) update: I investigated the gap in the end piece; see below for an image of the problem. The top axle uses LDCad's default flex axle template; note the space at the "hilt" of the cap part on the lower end. (Segment sizes have been adjusted at the lower end of the piece, but not the upper, hence the visible seams there.) The bottom axle shows the problem corrected after making my own adjustments—read on…
   

I tried using Philo's flex axle template, and it does indeed fix the problem. This template uses additional segments (77.dat) in the "handle" portion of the axle so that it, too, is flexible (it isn't in the LDCad version). It seems that the adjustment of segment sizes in this section creates enough overlap to eliminate the gap—which I bet comes from the same issue of the rendering software scaling the fake seams, because LDCad's version of the handle is a stud3a primitive scaled to a factor of 5. (Also, Philo's 77.dat segments aren't scaled, so any fake seams between them would likewise not be scaled.)

However, I wanted to keep using LDCad's version of the end piece, because I actually want the handle to remain rigid (along with retaining the snap info and path cap auto-grouping). So I made my own version of the LDCad donor part (ldcFlexAxleCap.dat), with some extra overlap hardcoded in by increasing the scaling factor for the stud3a primitive, with an appropriate Y-offset to compensate.

I then made my own version of the LDCad flex axle template, substituting my new cap donor part, as well as adjusting the base and segment sizes for the flexible segments, and setting them to static donor references. Finally, I copied all of LDCad's donor files into Studio's custom parts folder and rendered the file, resulting in the bottom part in the picture, with all of the issues corrected.  Big Grin

Here is my version of the flex axle template adapted for rendering in Studio; use this one if you want the "handle" portion to stay rigid. (If you want it to be flexible, use Philo's template.) There are two files provided: use the second one if you have copied the LDCad donor files into Studio's custom parts folder; otherwise, use the first one. Place the file into LDCad's "templates->path" directory.

.ldr   technicFlexAxle-Inline.ldr (Size: 3.25 KB / Downloads: 4)

.ldr   technicFlexAxle-noInline.ldr (Size: 3.25 KB / Downloads: 2)

To use either of these files, you need my modified path cap donor part; place it in LDCad's "donors" folder.

.dat   ldcFlexAxleCap2.dat (Size: 309 bytes / Downloads: 5)
Reply
RE: 3 - Flexible parts that need segment changes
#18
(2020-03-30, 20:08)N. W. Perry Wrote: This template uses additional segments (77.dat) in the "handle" portion of the axle so that it, too, is flexible (it isn't in the LDCad version).
It used to be, but I changed it in 1.6b, I think, in order to make it snap.
Reply
RE: 3 - Flexible parts that need segment changes
#19
(2020-03-30, 21:59)Roland Melkert Wrote: It used to be, but I changed it in 1.6b, I think, in order to make it snap.

Having the snap info definitely helps, but also I think you need the PATH_CAP meta in order to predictably place the ends (particularly at the non-origin end).
Reply
RE: 3 - Flexible parts that need segment changes
#20
(2020-03-30, 21:59)Roland Melkert Wrote: It used to be, but I changed it in 1.6b, I think, in order to make it snap.

These days the flex axles are being used very often with 11090, which only holds about half the length of the tip. So I made a version of the template that still snaps in to this part, but only to a depth of 10 LDU, and then is flexible after that like the real thing. It's attached below, along with the custom end cap donor you need.

.ldr   technicFlexAxle-bendy.ldr (Size: 4.41 KB / Downloads: 1)

.dat   ldcFlexAxleCap3.dat (Size: 299 bytes / Downloads: 1)

For some reason that I don't fully understand, I had to change the edge deletion setting for the ldcFlexAxleEndC (and only at one end). None of the other donors needed any adjustments.
Reply
RE: Using LDCad flexible parts with Studio
#7
Forgive me if this has been answered before, but is there something similar you have to do to use the spring parts? When I load a shock absorber into Studio, the spring mesh is not visible.
Reply
RE: Using LDCad flexible parts with Studio
#8
(2019-11-02, 5:54)N. W. Perry Wrote: Forgive me if this has been answered before, but is there something similar you have to do to use the spring parts? When I load a shock absorber into Studio, the spring mesh is not visible.
Well, yes, it's possible, but really convolved. The spring is generated by LDCad as a custom mesh, and there is no LQ version created with repeated LDraw elements. So the idea is to use the fallback code of the spring (used to see the spring outside LDCad) and put it as a custom part in Studio CustomParts\parts folder (Studio is unable to use parts embedded in MPD Sad ). Another drawback is that the spring is "frozen", so you can't adjust length after processing.

Here is the whole process...
- Start with LDCad code with shock absorbers (attachment shock1.mpd)
- Open it with a text editor.
- Search and replace string "springMesh.ldr" with "springMesh.dat" (Studio is unable to use part files with .ldr extensions Angry )
- Cut the section(s) of LDraw code after "0 FILE blahblah_springMesh.dat" and put them in separate file(s) named blahblah_springMesh.dat (attachments shock-06_5L-soft-1_springMesh.dat and shock-09_5L-hard-1_springMesh.dat).
- Place these files in Studio custom parts folder (C:\Users\<your user name>\AppData\Local\Stud.io\CustomParts\parts)
- Remove the 0 !LDCAD metacommand lines to avoid accidental changes of the code if you reopen file with LDCad
- Open resulting file in Studio (attachment shock2.mpd)

...but for most models I use uncompressed LDraw shortcuts to avoid the hassle!!!


Attached Files Thumbnail(s)
       

.mpd   shock1.mpd (Size: 1.77 MB / Downloads: 7)
.dat   shock-06_5L-soft-1_springMesh.dat (Size: 476.13 KB / Downloads: 6)
.dat   shock-09_5L-hard-1_springMesh.dat (Size: 1.3 MB / Downloads: 7)
.mpd   shock2.mpd (Size: 1.47 KB / Downloads: 7)
Reply
RE: Using LDCad flexible parts with Studio
#9
(2019-11-02, 10:52)Philippe Hurbain Wrote: Well, yes, it's possible, but really convolved. The spring is generated by LDCad as a custom mesh, and there is no LQ version created with repeated LDraw elements. So the idea is to use the fallback code of the spring (used to see the spring outside LDCad) and put it as a custom part in Studio CustomParts\parts folder (Studio is unable to use parts embedded in MPD Sad ). Another drawback is that the spring is "frozen", so you can't adjust length after processing.

Here is the whole process...
- Start with LDCad code with shock absorbers (attachment shock1.mpd)
- Open it with a text editor.
- Search and replace string "springMesh.ldr" with "springMesh.dat" (Studio is unable to use part files with .ldr extensions Angry )
- Cut the section(s) of LDraw code after "0 FILE blahblah_springMesh.dat" and put them in separate file(s) named blahblah_springMesh.dat (attachments shock-06_5L-soft-1_springMesh.dat and shock-09_5L-hard-1_springMesh.dat).
- Place these files in Studio custom parts folder (C:\Users\<your user name>\AppData\Local\Stud.io\CustomParts\parts)
- Remove the 0 !LDCAD metacommand lines to avoid accidental changes of the code if you reopen file with LDCad
- Open resulting file in Studio (attachment shock2.mpd)

...but for most models I use uncompressed LDraw shortcuts to avoid the hassle!!!

Wow, convolved indeed, but superbly helpful, thanks! I don't have much fear of accidentally ruining the file in Studio, as I'll only bring it in there for rendering…we'll see how that goes.
Reply
RE: Using LDCad flexible parts with Studio
#10
(2019-11-03, 5:34)N. W. Perry Wrote: Wow, convolved indeed, but superbly helpful, thanks! I don't have much fear of accidentally ruining the file in Studio, as I'll only bring it in there for rendering…we'll see how that goes.
No risk indeed with Custom parts folder. Actually I tend to use it in a "project specific" manner, I put there only the parts needed, and cleanup everything at the end (sometimes I zip the whole folder if I want to keep it for later). Too many parts there slows down Studio part editor startup.
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)