OpenScad import: Unsupported Function r....

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!
Aimsport
Posts: 1
Joined: Sun Mar 26, 2017 3:20 am

OpenScad import: Unsupported Function r....

Post by Aimsport »

Hi all. First post.

In trying to open an OpenScad file I get a small dialog box saying "Unsported Function: r..." but have no idea how to read the full text of the error.

Also, is there a list of unsupported OpenScad functions somewhere?
User avatar
agryson
Posts: 463
Joined: Wed Nov 23, 2016 8:30 am
Location: Bordeaux, France
Contact:

Re: OpenScad import: Unsupported Function r....

Post by agryson »

Hi @Aimsport, welcome to the forum.

Could you please follow the instructions in the big red box above your post to include all the info that could help people out?
Version information and sample files that show the problem help us help you.
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: OpenScad import: Unsupported Function r....

Post by bejant »

Hi Aimsport and welcome from me as well. The following links should get you started:

Per Agryson and because it is customary here:
viewtopic.php?f=3&t=2264

OpenSCAD specific links:
http://freecadweb.org/wiki/Import_OpenSCAD_code
http://freecadweb.org/wiki/index.php?ti ... CAD_Module

(OpenSCAD itself needs to be installed separately because it's not included in FreeCAD)
User avatar
bejant
Veteran
Posts: 6075
Joined: Thu Jul 11, 2013 3:06 pm

Re: OpenScad import: Unsupported Function r....

Post by bejant »

Sorry, I forgot to answer this:
Aimsport wrote:In trying to open an OpenScad file I get a small dialog box saying "Unsported Function: r..." but have no idea how to read the full text of the error.
Try View (pull-down menu) > Panels and tick Report View and Python Console to True.
Next go to Edit > Preferences > General (icon in left pane) > Output Window (tab in right pane) and change the tick-boxes like so:
20170326a.png
20170326a.png (86.27 KiB) Viewed 2650 times
nokian
Posts: 40
Joined: Wed Sep 14, 2016 8:22 pm

Re: OpenScad import: Unsupported Function r....

Post by nokian »

Similar bug using latest FC master:

"Unsupported Function: projection"

Code to test it out:

Code: Select all

  hull () {
      linear_extrude (height=1, center=true){
        projection (cut = false) {
          mirror ([1, 0, 0]) {
            mirror ([0, 1, 0]) {
                cylinder (h=2, r=20, center=true);           
            }
          }
        }
      }
  }
Error message in console:
Linear Extrude With Twist
('Twist : ', {'scale': [1.0, 1.0], 'center': 'true', '$fs': '2', 'height': '1', '$fn': '0', '$fa': '12', 'convexity': '1'})
Traceback (most recent call last):
File "/opt/freecad/Mod/OpenSCAD/OpenSCADCommands.py", line 305, in addelement
importCSG.insert(tmpfilename,doc.Name)
File "/opt/freecad/Mod/OpenSCAD/importCSG.py", line 121, in insert
processcsg(filename)
File "/opt/freecad/Mod/OpenSCAD/importCSG.py", line 145, in processcsg
result = parser.parse(f.read())
File "/opt/freecad/Mod/OpenSCAD/ply/yacc.py", line 265, in parse
return self.parseopt_notrack(input,lexer,debug,tracking,tokenfunc)
File "/opt/freecad/Mod/OpenSCAD/ply/yacc.py", line 971, in parseopt_notrack
p.callable(pslice)
File "/opt/freecad/Mod/OpenSCAD/importCSG.py", line 657, in p_linear_extrude_with_twist
if (len(p[6]) == 0) :
TypeError: object of type 'NoneType' has no len()
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenScad import: Unsupported Function r....

Post by keithsloan52 »

projection with cut = false is not supported.

see line 1197 onwards in importCSG.py i.e.

Code: Select all

else: # cut == 'false' => true projection^M
1198         if gui and not FreeCAD.ParamGet("User parameter:BaseApp/Preferences     /Mod/OpenSCAD").\^M
1199                 GetBool('usePlaceholderForUnsupported'):^M
1200             from PySide import QtGui^M
1201             QtGui.QMessageBox.critical(None, unicode(translate('OpenSCAD',"     Unsupported Function"))+" : "+p[1],unicode(translate('OpenSCAD',"Press OK")     ))^M
The error in Linear Extrude With Twist occurs because the projection does not return anything to the object stack.

I do not recognise the code for handling projection, so I assume its something that shoogen added.

The following OpenSCAD operations are not support, there may be others
  • glide
    resize
    subdiv
Suspect that the OP's error was resize unsupported, but cannot tell without further info.
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenScad import: Unsupported Function r....

Post by keithsloan52 »

If Aimsport and others want support for resize then somebody should raise a request in the FreeCAD Tracker to support a Toposhape resize request in the FreeCAD API, then resize could be added as a supported function to OpenSCAD. A Toposhape resize should be possible as OCC seems to support a resizing operation see https://www.opencascade.com/content/resizing-shape

Update: Just rechecked the FreeCAD docs and FreeCAD Toposhape does support transformShape ( matrix ). I will try and find some time to look at adding support for the OpenSCAD resize request.
nokian
Posts: 40
Joined: Wed Sep 14, 2016 8:22 pm

Re: OpenScad import: Unsupported Function r....

Post by nokian »

Next time I will look into the script before I ask.

Do you know a workaround so I can use "projection(cut = false)"? Maybe a freecad function?

I can't use other commands, as the OpenScad code is generated by another piece of code I can't edit.
Somehow I have to deal with the "cut = false".
keithsloan52
Veteran
Posts: 2764
Joined: Mon Feb 27, 2012 5:31 pm

Re: OpenScad import: Unsupported Function r....

Post by keithsloan52 »

projection ( cut = true) adds a plane to an object's shape. If somebody can suggest a way of performing a projection ( cut = false ) then I would look at updating ImportCSG.py.

i.e. At the time of the projection request ImportCSG.py has the relevant object on a stack and access to the matrix and needs to perform the projection request using the FreeCAD API returning an object.
User avatar
chennes
Veteran
Posts: 3914
Joined: Fri Dec 23, 2016 3:38 pm
Location: Norman, OK, USA
Contact:

Re: OpenScad import: Unsupported Function r....

Post by chennes »

keithsloan52 wrote: Sat Oct 07, 2017 8:18 pm Update: Just rechecked the FreeCAD docs and FreeCAD Toposhape does support transformShape ( matrix ). I will try and find some time to look at adding support for the OpenSCAD resize request.
Hi @keithsloan52, did anything ever come of this? I see that the resize() code in importCSG is still calling Draft.resize(), so doesn't actually do anything to 3D geometry.
Chris Hennes
Pioneer Library System
GitHub profile, LinkedIn profile, chrishennes.com
Post Reply