Create Precast Pillar with Ghost Tracker

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
SBlade
Posts: 40
Joined: Fri May 01, 2020 8:38 pm

Create Precast Pillar with Ghost Tracker

Post by SBlade »

Hi,

I want to create ArchPrecast Pillar object with the foloowing code but I can not succed:

Code: Select all

import ArchPrecast
dents=['400.0;250.0;600.0;150.0;1500.0;90;0.0']
p = ArchPrecast.makePrecast(slabtype="Champagne",chamfer=2.0,dentlength=0.0,dentwidth=20.0,dentheight=40.0,base=0.0,holenumber=0,holemajor=0.0,holeminor=0.0,holespacing=0.0,groovenumber=0,groovedepth=0.0,grooveheight=0.0,groovespacing=0.0,risernumber=0,downlength=0.0,riser=0.0,tread=0.0,dents[], precasttype="Pillar",length=300.0,width=250.0,height=2000.0,)
App.activeDocument().recompute()
but the Python compiler complains about:

Code: Select all

  File "<input>", line 1
    dents=['400.0;250.0;600.0;150.0;1500.0;90;0.0']
                                                  ^
SyntaxError: multiple statements found while compiling a single statement
It is obvious that I don't know exactly how to pass a list to the function, I think the glitch here is that, your guidance will be appreciated.


And also how to integrate Ghost tracker in such case?
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Create Precast Pillar with Ghost Tracker

Post by onekk »

SBlade wrote: Sun Jun 26, 2022 5:47 pm

Code: Select all

  File "<input>", line 1
  dents=['400.0;250.0;600.0;150.0;1500.0;90;0.0']
                                                  ^
SyntaxError: multiple statements found while compiling a single statement

in Python [] define a list and the list separator is comma ,

with the writing above you have passed probably a string '' although the error seem indicate that something else could have been wrong, as it signal that a multiline statement, that is usually triggered using ; that in python is used very rarely.

I don't get to guess why it is not parsed as a string, and why the error is not at the first ;, but probably this is not the problem.

if is a list probably:

Code: Select all

   dents=[400.0, 250.0, 600.0, 150.0, 1500.0, 90, 0.0]
is the correct writing

Hope it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
SBlade
Posts: 40
Joined: Fri May 01, 2020 8:38 pm

Re: Create Precast Pillar with Ghost Tracker

Post by SBlade »

I tried that w/o sucess, probably your are right something different is causing the wreak havoc

If it helps at below link you can find the whole error screen:
https://imgur.com/a/eLqfvDi

I simply pass the dents list to ArchPrecast.makePrecast function as reference argument simply like dents, Is it correct ?

Code: Select all

import ArchPrecast
#dents=['400.0;250.0;600.0;150.0;1500.0;90;0.0']
dents=[400.0, 250.0, 600.0, 150.0, 1500.0, 90, 0.0]
p = ArchPrecast.makePrecast(slabtype="Champagne",chamfer=2.0,dentlength=0.0,dentwidth=20.0,dentheight=40.0,base=0.0,holenumber=0,holemajor=0.0,holeminor=0.0,holespacing=0.0,groovenumber=0,groovedepth=0.0,grooveheight=0.0,groovespacing=0.0,risernumber=0,downlength=0.0,riser=0.0,tread=0.0,dents, precasttype="Pillar",length=300.0,width=250.0,height=2000.0,)
App.activeDocument().recompute()
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Create Precast Pillar with Ghost Tracker

Post by onekk »

you cannot mix "named parameter" and unnmamed ones.

so you must put

Code: Select all

dents=dents
when passing dents variable.

Better to change name maybe dent_list, dent_l or d_list name is not important but for mnemonic it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply