LDPE 1.8.60 Released (!LPE CONST expressions)


1.8.60 Released (!LPE CONST expressions)
#1
Hey,

this release introduces a complex and powerful feature:
The !LPE CONST meta command.
It allows you to use constants in almost any line type and replace them with a real value when needed.
However, the constants will be removed from a line when the line is modified from another source that is not the constant itself.
When you change a value of a constant afterwards, you need to click manually on the "Update/compile linked subfile data" button.

.png   icon32_subcompile.png (Size: 1.72 KB / Downloads: 71)
You can see the calculated value in the warnings section of the text editor.

Syntax:
Code:
0 !LPE CONST variable = expression
0 // variable and expression must not contain spaces.

With that you can do things like:

Code:
0 !LPE CONST red = 4
0 !LPE CONST green = "0x200ff00"

1 red 3 0 0 1 0 0 0 1 0 0 0 1 box.dat
1 green 0 0 0 1 0 0 0 1 0 0 0 1 box.dat
1 red -3 0 0 1 0 0 0 1 0 0 0 1 box.dat

When you quick fix the warnings for the variable declarations, it will become:
Code:
1 4 3 0 0 1 0 0 0 1 0 0 0 1 box.dat
1 0x200ff00 0 0 0 1 0 0 0 1 0 0 0 1 box.dat
1 4 -3 0 0 1 0 0 0 1 0 0 0 1 box.dat

Code:
0 !LPE CONST angle = 20

0 !LPE CONST rx = cos(rad(angle))
0 !LPE CONST ry = sin(rad(angle))

0 !LPE CONST cx = 10*rx
0 !LPE CONST cy = 10*ry

1 7 10 0 0 1 0 0 0 1 0 0 0 1 box.dat

1 8 cx cy 0 rx -ry 0 ry rx 0 0 0 1.5 box.dat

0 !LPE CONST angle = angle+20
0 !LPE CONST rx = cos(rad(angle))
0 !LPE CONST ry = sin(rad(angle))

0 !LPE CONST cx = 10*rx
0 !LPE CONST cy = 10*ry

1 15 cx cy 0 rx -ry 0 ry rx 0 0 0 2 box.dat

It is possible to use the constants directly in subfiles.
But you can not automatically replace them with a quick fix from the parent file.
Code:
0 !LPE CONST subX = 8
0 !LPE CONST subY = 2
0 !LPE CONST subZ = 3

1 16 0 0 0 1 0 0 0 1 0 0 0 1 subfile.dat

subfile.dat
Code:
2 24 0 0 0 subX subY subZ
1 16 subX subY subZ 1 0 0 0 1 0 0 0 1 8-8sphe.dat

You can also combine it with the CSG or INLINE meta commands.

Code:
0 !LPE CSG_QUALITY 16

0 !LPE CONST cubeH = 1
0 !LPE CONST cubeH2 = cubeH*2
0 !LPE CONST sphereH = cubeH*1.35

0 // Won't override CSG constants
0 !LPE CONST csgA = 42

0 !LPE CSG_CUBOID    csgA  4 0 0 0 cubeH   0 0 0 cubeH   0 0 0 cubeH
0 !LPE CSG_ELLIPSOID csgB  1 0 0 0 sphereH 0 0 0 sphereH 0 0 0 sphereH

0 !LPE CSG_CYLINDER  csgC  2 0 -cubeH 0 .7 0 0 0 cubeH2 0 0 0 .7
0 !LPE CSG_CYLINDER  csgD  2 -cubeH 0 0 0 cubeH2 0 .7 0 0 0 0 .7
0 !LPE CSG_CYLINDER  csgE  2 0 0 -cubeH .7 0 0 0 0 .7 0 cubeH2 0

0 !LPE CSG_UNION csgC csgD csgD
0 !LPE CSG_UNION csgD csgE csgD
0 !LPE CSG_INTERSECTION csgA csgB csgF
0 !LPE CSG_DIFFERENCE csgF csgD csgF

0 !LPE CSG_COMPILE csgF
It does not support !TEXMAP / !: lines yet.

[Image: imgDuke2.png]

As always, you can download LDPE from this page:

http://nilsschmidt1337.github.io/ldparteditor/

Changelog:

(4 new features)

With this release you will be able to...
  • ...use the "!LPE CONST" meta command to define re-usable constants in parts and subparts.
  • ...use calculated expressions for constants, too.
  • ...quick-fix/replace constants with the text editor.
  • ...combine "!LPE CONST" with "!LPE CSG" meta commands (but not with !TEXMAP commands, yet).

The program was tested intensively with "real world" files.
However, something can go wrong in about 140.000 lines of code.

Installation on Windows:

  1. Download and extract LDPartEditor_win32_x64.zip
  2. Run LDPartEditor-1.8.60.msi
  3. Start LDPartEditor from the start menu
Installation on Linux:

  1. Download and extract LDPartEditor_linux_x64.zip
  2. Install ldparteditor_1.8.60-1_amd64.deb
  3. Start LDPartEditor from the menu or via launcher
Installation on Mac OS X:

  1. Download and extract LDPartEditor_mac_x64.zip
  2. Mount LDPartEditor-1.8.60.dmg
  3. Drag LDPartEditor.app to the Applications folder
  4. Copy ldparteditor.sh to your home folder
        4a. Open a Terminal.app and run ./ldparteditor.sh
        4b. Or open a Terminal.app and run /Applications/LDPartEditor.app/Contents/MacOS/LDPartEditor

I listen carefully to your requests and possible complaints. Please leave me a message, with your thoughts and wishes to further improve the software.

LDPE is a 3D CAD application: The overall system requirements are higher. While I recommend to use a powerful 64-bit multicore system, it could be possible, to run LDPE on older machines as well.

System Requirements:

Minimum System Requirements:
  • OpenGL 2.1 compatible Graphics Card
  • Operating System (64-bit): Windows [7 or newer], Linux [e.g. Ubuntu Linux >=14.4], Mac OS X [>=10.6]
  • CPU: Multicore-Processor e.g. Intel Core 2 Duo or AMD Athlon II (>2.0Ghz)
  • RAM: 4GB
  • Video-Memory: 1 GB
  • Free Disk Space: 100 MB
Recommended Requirements:
  • Operating System (64bit): Windows 7,8,10, Linux [e.g. Ubuntu Linux >=14.4], Mac OS X [>=10.6]
  • OpenGL 3.3 compatible Graphics Card
  • CPU: Multicore-Processor with 4 cores (or more)
  • RAM: >4 GB
  • Video-Memory: >1 GB
  • Free Disk Space: 512 MB
  • For a faster start, LDPartEditor and the LDraw™ library should be installed on an SSD.
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#2
Just out of curiosity.  What happened between version 0.8.53 and 1.8.54?
I think I understand already, but why keep the old version numbering.
Reply
A note on version numbering.
#3
(2022-07-10, 11:50)Magnus Forsberg Wrote: Just out of curiosity.  What happened between version 0.8.53 and 1.8.54?
I think I understand already, but why keep the old version numbering.

It was a technical reason required by Mac OS X to increase the first number from zero to one.
I had to change 0.x.x to 1.x.x because of that. Otherwise, I would have taken just 0.8.54.
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#4
Very cool to see this feature implemented

Going to try it out later today
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#5
Wow this is really cool! I really like the quick fix concept because at the end of the day I can make a template file, change the constants, then save as the new iteration. 

It would be cool to see this meta be added to other editors but that is awesome. 

I am not quite following the explanation of the subfile explanation. I think it is saying that the constants cannot be changed from the working file into a subfile?

For example:

Code:
Sub-file A
0 !LPE CONST height = 7

1 16 0 height 0 6 0 0 0 -height 0 0 0 6 box5.dat


Cannot be changed in a working file this this:
Code:
Working File
0 !LPE CONST height = 7

1 16 0 0 0 1 0 0 0 1 0 0 0 1 Sub-file A.dat

Is my understanding correct?
Reply
!LPE CONST and subfiles
#6
(2022-07-10, 16:55)Cam's Bricks Wrote: Wow this is really cool! I really like the quick fix concept because at the end of the day I can make a template file, change the constants, then save as the new iteration. 

It would be cool to see this meta be added to other editors but that is awesome. 

I am not quite following the explanation of the subfile explanation. I think it is saying that the constants cannot be changed from the working file into a subfile?

For example:

Code:
Sub-file A
0 !LPE CONST height = 7

1 16 0 height 0 6 0 0 0 -height 0 0 0 6 box5.dat


Cannot be changed in a working file like this:
Code:
Working File
0 !LPE CONST height = 7

1 16 0 0 0 1 0 0 0 1 0 0 0 1 Sub-file A.dat

Is my understanding correct?

You can do something like:

Code:
Working File
0 !LPE CONST height = 7

1 16 0 0 0 1 0 0 0 1 0 0 0 1 Sub-file A.dat

Code:
Sub-file A
0 // No constant needed, because it is defined in the working file (!LPE CONST height = 7)
0 // But you can override the value if you like.

1 16 0 height 0 6 0 0 0 -height 0 0 0 6 box5.dat

Code:
Sub-file A
0 // Now the height would be 5 instead of 7
0 !LPE CONST height = 5

1 16 0 height 0 6 0 0 0 -height 0 0 0 6 box5.dat

Another elegant possibility is this:
Code:
Sub-file A
0 // Now you can quick fixing the declaration in the subfile, too.
0 !LPE CONST subheight = height

1 16 0 subheight 0 6 0 0 0 -subheight 0 0 0 6 box5.dat


Thanks! You described here one of the main benefits:
"I really like the quick fix concept because at the end of the day I can make a template file, change the constants, then save as the new iteration. "
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#7
Hmm, I can no longer seem to open the program without getting the "This app is damaged…" message. Calling the executable directly no longer seems to work around this.

This is on the new M1 Mac under OS 12.5 Monterey. Not specific to this version of LDPE.

I'll keep trying, but has anyone else gotten the app running on a silicon Mac?
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#8
(2022-07-23, 16:02)N. W. Perry Wrote: I'll keep trying, but has anyone else gotten the app running on a silicon Mac?

Yes I am! I also encountered this error and found out a way to make it work. Open a Terminal and enter the following commands one by one:

sudo spctl --master-disable
sudo chmod -R 777 /Applications/LDPartEditor.app
xattr -d com.apple.quarantine /Applications/LDPartEditor.app
xattr -cr /Applications/LDPartEditor.app

The first command allows applications from unidentified developers
The second might be optional but will repair the application's permissions if required
The third and fourth lines will add the application to the whitelist of Gatekeeper, Apple's protection system
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#9
(2022-07-25, 19:03)Vincent Messenet Wrote: Yes I am! I also encountered this error and found out a way to make it work. Open a Terminal and enter the following commands one by one:

sudo spctl --master-disable
sudo chmod -R 777 /Applications/LDPartEditor.app
xattr -d com.apple.quarantine /Applications/LDPartEditor.app
xattr -cr /Applications/LDPartEditor.app

The first command allows applications from unidentified developers
The second might be optional but will repair the application's permissions if required
The third and fourth lines will add the application to the whitelist of Gatekeeper, Apple's protection system

Hmm. OK, I'll look more into it. I had been getting an error message with the xattr commands, saying there's no such attribute as "com.apple.quarantine".

But I notice you're acting on the .app package itself, rather than the executable inside it, which might be the reason.
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#10
(2022-07-25, 21:21)N. W. Perry Wrote: Hmm. OK, I'll look more into it. I had been getting an error message with the xattr commands, saying there's no such attribute as "com.apple.quarantine".

But I notice you're acting on the .app package itself, rather than the executable inside it, which might be the reason.

Well, I got farther than before, now the error is:
"The program cannot be used, because you have no rights to write to the application folder."

The chmod should have fixed that, no?
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#11
(2022-07-26, 5:54)N. W. Perry Wrote: Well, I got farther than before, now the error is:
"The program cannot be used, because you have no rights to write to the application folder."

The chmod should have fixed that, no?
Yes, it should. Can you elaborate on how you launched it?

On my side I launch a script ldparteditor.sh located in my user folder which contains the following command line:
/Applications/LDPartEditor.app/Contents/MacOS/LDPartEditor

Also if you do command+I on LDPartEditor.app do you confirm read&write permissions are granted for everyone?
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#12
(2022-07-26, 6:15)Vincent Messenet Wrote: Yes, it should. Can you elaborate on how you launched it?

On my side I launch a script ldparteditor.sh located in my user folder which contains the following command line:
/Applications/LDPartEditor.app/Contents/MacOS/LDPartEditor

You know what, that was it. I had forgotten you still have to launch the executable directly. And I was thrown off because when I opened the package, I still got as far as the setup dialog and launch progress bar before the error message was thrown.

Of course, now that it's open I have a different bug, but I'll put that in another post!
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#13
Here's the bug I'm getting (M1 MacBook Pro, OS 12.5 Monterey):
   

See how in the 3D editor window (and in the primitives pane), the windows themselves are the right size but their graphics are too small by half. Mouse input works across the full window, however—so if I wanted the drop-down menu in the 3D editor, I'd have to mouse over the upper-left corner of the blank white area.
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#14
(2022-07-26, 21:37)N. W. Perry Wrote: Here's the bug I'm getting (M1 MacBook Pro, OS 12.5 Monterey):


See how in the 3D editor window (and in the primitives pane), the windows themselves are the right size but their graphics are too small by half. Mouse input works across the full window, however—so if I wanted the drop-down menu in the 3D editor, I'd have to mouse over the upper-left corner of the blank white area.

That's a known problem (with a workaround): https://github.com/nilsschmidt1337/ldpar...issues/755
Reply
RE: 1.8.60 Released (!LPE CONST expressions)
#15
(2022-07-26, 23:05)Travis Cobbs Wrote: That's a known problem (with a workaround): https://github.com/nilsschmidt1337/ldpar...issues/755

Ah, yes. I knew it seemed vaguely familiar!
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 5 Guest(s)