Can not excute complex openscad code.

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!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Can not excute complex openscad code.

Post by NormandC »

eexpss wrote:I usually only use the software inside the repo.
Suit yourself but
NormandC wrote:If you're on Ubuntu or a Ubuntu-based distro, please realize that the version provided in the Ubuntu official repository is utterly obsolete, and that we do not support it.
eexpss
Posts: 56
Joined: Wed Dec 28, 2016 6:17 am

Re: Can not excute complex openscad code.

Post by eexpss »

DeepSOIC wrote:
eexpss wrote:Can you sure the new version can run this code right?
We most likely can't, since most of us don't have that font installed.
OpenSCAD importer did get some changes since 0.15, but I didn't ever use it so I have no idea. But there is some chance. Updating to 0.16 definitely won't hurt anyway ;)
The openscad code, only need change two lines to work for you. Please help to confirm it can work with 0.16 version.

first line:
font="经典繁毛楷,fan\-maokai:style=Regular,maokai";
change to
font="DejaVu Sans:style=Bold";

last line:
text_on_cylinder("御风而行",5.5,true);
change to
text_on_cylinder("It works",5.5,false);

:)
eexpss
Posts: 56
Joined: Wed Dec 28, 2016 6:17 am

Re: Can not excute complex openscad code.

Post by eexpss »

I had upgrade to 0.16. The result is same as 0.15.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Can not excute complex openscad code.

Post by DeepSOIC »

eexpss wrote:I had upgrade to 0.16. The result is same as 0.15.
That's unfortunate. But now, with the power of expression support, why don't you give it a try to reproduce your openscad model using freecad tools? ;)
eexpss
Posts: 56
Joined: Wed Dec 28, 2016 6:17 am

Re: Can not excute complex openscad code.

Post by eexpss »

But that function in openscad can accept 3 parameters, I modify the function many times, it works well.

Each character had been departed into several slices, not just rotate one character.

otherwise there is no corresponding ready-made tools in freecad. I hope someone can write a python code here.
I had test the code at https://gist.github.com/mangtronix/7f5b7cb4dc5f75019890. Not well work with unicode. I modify the code many times, just one Chinese character can display, and it is plane one. Of course I am not skill at python, I use perl. :mrgreen:
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Can not excute complex openscad code.

Post by NormandC »

keithsloan52 wrote:
Is the person who'll be able to tell more as he's one of the two developers who worked on the OpenSCAD workbench.

(Empty quote so he receives a notification)
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Can not excute complex openscad code.

Post by keithsloan52 »

Sorry for the delay I was on a long holiday in New Zealand from 16th Feb till 7th April

Support for OpenSCAD text command, basically takes the text command and creates it as a one line command and calls the OpenSCAD module telling it to create the output as a dxf file. It then imports that dxf file as a FreeCAD object using the import DXF file as a face function.

(Assuming you have a version of ImportCSG.py that attempts to supports the OpenSCAD text you should have a function called processTextCmd on my system it is at line 714.)

Text support was added in this pull request viewtopic.php?f=27&t=17871&p=140410#p140410

Looking at the code the op is trying to use, I am not sure that the implementation will cope with a translate request. One could try creating a simple test case with just a translate and text command. Testing with OpenSCAD and testing with FreeCAD.

A work around for dealing with text before the support was added was to do the following create two scad files.
One with the text i.e. text("test");
render it under OpenSCAD and export as DXF i.e. saved_text.dxf

create a second scad file
linear_extrude() import( file="saved_text.dxf");
and load the second scad file in FreeCAD

One might test with a translate rather than linear_extrude
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Can not excute complex openscad code.

Post by keithsloan52 »

eexpss wrote:I had upgrade to 0.16. The result is same as 0.15.
If you just installed the stable version of 0.16 this might not have the support for OpenSCAD text command.
You should be able to load /usr/lib/freecad/Mod/OpenSCAD/importCSG.py and look for a function called processTextCmd. If its not present then you do not have a version that supports OpenSCAD text.

Like I said before text was added in this pull request viewtopic.php?f=27&t=17871&p=140410#p140410
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Can not excute complex openscad code.

Post by keithsloan52 »

Okay I tried the original file. Had to mod to use Non Chinese font. The user OpenSCAD module splits a text string into individual characters. This showed up a bug in that text handling in importCSG.py was not handling a single null string or blank character. I have now fixed the code see pull request
https://forum.freecadweb.org/viewtopic.php?f=17&t=22088

PLEASE BE PATIENT WHEN USING the original scad file as the process is very slow due to all text being converted via DXF files

During my investigations I tried contacting eexpss but he does not seem to be around any more. But anyway things are now hopefully fixed.

Output file too large to attach, so here is a screen shot
screenshot.png
screenshot.png (7.64 KiB) Viewed 1528 times
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: Can not excute complex openscad code.

Post by keithsloan52 »

Noticing @eexpss has not logged onto the forum for quite a while, this is an attempt to get an email to him/her to let him/her know that this problem is hopefully fixed. Or does @userid only work from Mantis Bugtracker?
Post Reply