Page 1 of 1

Create Precast Pillar with Ghost Tracker

Posted: Sun Jun 26, 2022 5:47 pm
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?

Re: Create Precast Pillar with Ghost Tracker

Posted: Sun Jun 26, 2022 6:02 pm
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.

Re: Create Precast Pillar with Ghost Tracker

Posted: Sun Jun 26, 2022 6:20 pm
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()

Re: Create Precast Pillar with Ghost Tracker

Posted: Sun Jun 26, 2022 8:14 pm
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.