Graphscad

Graphscad : The Graphic Nodal Editor for OpenScad
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Use of global setting variable $fn inconsistant

View previous topic View next topic Go down 
AuthorMessage
Kpacnaja_Shapotshka



Messages : 8
Date d'inscription : 2017-02-11

PostSubject: Use of global setting variable $fn inconsistant   Mon 13 Feb - 1:10

Hi,

I played around with the switchcasedemo, inserted a globalsettings node, set the $fn to 50 and noticed some quirks.

I expected the global setting $fn being used by the cylinder, sphere and roundcube when the local $fn is omitted/empty.
That was not the case.
When the local $fn was empty with a sphere or cylinder, the local $fn was implicitly set to be 16+1*3.14116.
When the local $fn was empty with the roundcube, following code was generated for the eight hulled corner spheres:

    translate([-(((1)/2)-0.1),-(((1)/2)-0.1),-(((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([-(((1)/2)-0.1),-(((1)/2)-0.1), (((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([-(((1)/2)-0.1), (((1)/2)-0.1),-(((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([-(((1)/2)-0.1), (((1)/2)-0.1), (((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([ (((1)/2)-0.1),-(((1)/2)-0.1),-(((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([ (((1)/2)-0.1),-(((1)/2)-0.1), (((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([ (((1)/2)-0.1), (((1)/2)-0.1),-(((1)/2)-0.1)]) sphere(r=0.1,$fn=);
    translate([ (((1)/2)-0.1), (((1)/2)-0.1), (((1)/2)-0.1)]) sphere(r=0.1,$fn=);

This leads to a parser error.

I would suggest the following:
1. When the local $fn  is not set (empty) in these nodes and a global $fn is set, dont generate code for a local $fn. Then the global setting is used for these objects.
2. When the local $fn  is not set (empty) in these nodes and a global $fn is also not set, generate code for a implicitly set local $fn for all of these objects.
Then we have proper looking spheres, cylinders and roundcubes, not etchy ones. And we dont get parser errors.

This may also apply  for other advanced  rounded objects.

Kpacnaja_Shapotshka
Back to top Go down
View user profile
Admin
Admin


Messages : 59
Date d'inscription : 2017-01-08

PostSubject: Re: Use of global setting variable $fn inconsistant   Mon 13 Feb - 22:20

you're perfectly right. will try to implement this. The complex thing is just knowing if global $fn was set by a global node... but it's possible.
Back to top Go down
View user profile http://graphscad.forumotion.com
Admin
Admin


Messages : 59
Date d'inscription : 2017-01-08

PostSubject: Re: Use of global setting variable $fn inconsistant   Tue 14 Feb - 0:13

fixed. will be available in v1.0.7. example fn_orveridetest.scad
Back to top Go down
View user profile http://graphscad.forumotion.com
Sponsored content




PostSubject: Re: Use of global setting variable $fn inconsistant   

Back to top Go down
 
Use of global setting variable $fn inconsistant
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Graphscad :: Issues-
Jump to: