How to use expressions as in OpenScad

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: How to use expressions as in OpenScad

Post by keithsloan52 »

g0erwt wrote: Thu Jul 22, 2021 6:27 pm Maybe that will bring more evidence of what is happening in the FreeCAD OpenSCAD-Workbench.FreeCAD-OpenSCAD-Workbench_new_result.png
The evidence is that you are drawing overlapping shapes.
Here is the CSG that I have modified by entering a * in front of the drawing of each shape ( As per https://en.wikibooks.org/wiki/OpenSCAD_ ... Characters and my previous post.)

If you like you can also do this or just take this file
Ruhig_Blut-reconstructieModded.csg.scad
(1.68 KiB) Downloaded 6 times
Load the file into OpenSCAD and remove one of the '*' then do Design | Render
it will draw the shape.

Now go onto the next '*' and repeat you will soon see that YOU ARE DRAWING SOME SHAPES ON TOP OF OTHER SHAPES.
That is your problem. If you change your code so that shapes are NOT drawn on TOP of other Shapes it will work in both OpenSCAD
(No funny shading) and in FreeCAD.
User avatar
g0erwt
Posts: 11
Joined: Mon Jul 19, 2021 3:45 pm
Contact:

Re: How to use expressions as in OpenScad

Post by g0erwt »

@keithsloan52 What I'm doing right now is doing the same with my original description.
I'll let you know what the result is. Could be to morrow.

Update: 2021-07-23 17:45

I've downloaded the modded-file and changed the expression {color()} into {color("tan")} to have a clear indication that all colors are named. Then I went through it step by step all the way from 1 till 13.
Some interresting observations come out running under MacOS 10.15.7 (Catalina) and MacBookAir (4,1).

The first block, trianges 1, 2 and 3, in the left block of the puzzle are as expected. Adding piece 4, which is identical with piece 1, everything is still ok.
From piece 5 on everything is not as expected. See the screenshot of this phase.
Q.: where does this white triangle come from?
And yes!! now I find the rules in the list of elements that shouldn't be there. That triangle and also the trapezium where meant to be intermediate steps to find the connection for the pieces in the middle.

It's there that the problem of overlapping triangles occurs.
Modded-5-white.png
Modded-5-white.png (17.48 KiB) Viewed 224 times
Modded-6-magenta.png
Modded-6-magenta.png (17.12 KiB) Viewed 224 times
Thank you very much for your help.

However, there is another observation, that you can only spot on a slower machine!!

From this model Modded-5-elements on to the end the programm generates the correct model. You can see that in a split second if you are alert. I could only catch it far in the process where the processor needed time to finish the end result.
See attachments [Modded-13-i-elements] and [Modded-13-elements]. Where the -i- stands for intermediate picture.

Modded-13-i.png
Modded-13-i.png (38.71 KiB) Viewed 224 times
Modded-13-all.png
Modded-13-all.png (37.48 KiB) Viewed 224 times
I'll come back to this after correcting the model.
Correcting the model gives this result.
Still a error somewhere.

Sure that the second blue triangle was not part of the puzzle, but just a tool to find some intersections. So, eliminating this brings everything back to normal.

Anyway, I can cope with this I think.
Good learning process.

Thanks everybody.
Attachments
FreeCAD-Ruhig_Blut_final.png
FreeCAD-Ruhig_Blut_final.png (11.31 KiB) Viewed 224 times
User avatar
g0erwt
Posts: 11
Joined: Mon Jul 19, 2021 3:45 pm
Contact:

Re: How to use expressions as in OpenScad

Post by g0erwt »

Final screenshot
FreeCAD-Ruhig_Blut-corrected.png
FreeCAD-Ruhig_Blut-corrected.png (10.77 KiB) Viewed 223 times
Case can be closed.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: How to use expressions as in OpenScad

Post by keithsloan52 »

g0erwt wrote: Fri Jul 23, 2021 7:41 pm Final screenshot

FreeCAD-Ruhig_Blut-corrected.png

Case can be closed.
Glad you made it.
You cannot teach an Old Dog New Tricks
But you can an Old Cat Lover

:D :D :D :D :D :D :D :D
Post Reply