The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Discussions about using GRAPHISOFT's tools (API DevKit) for independent software developers

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, gkmethy, MOREH Tamas, Akos Somorjai, Ed Brown, Mihály Palenik, Tibor Lorántfy, rmasaki

#304440
I strongly support development of python inside archciad. I think this is great first step. I would like to see faster development and more documentation if possible.
Also, could someone point me where to find defitionGuid for ID parameter (or any other) of an element?
#304476
Petar.Pejic wrote:I managed to get and change ID of elements, but I am struggling how to get for example composite name of the wall? Should one use getproperty or getattribute?
I sometimes do this: if I can not find how to access the desired parameter then I use *.List(). The console unloads a list of all parameters and you can try to find the one that affects the composite wall.
See attached screenshot.

if it helps here:
Code: Select all
guid = ClickElement()

element = GetWall(guid)
index_attrib_composit = 19
index_attrib_build_mat = 3

element.modelElemStructureType = 1  # 0 - non-composit, 1 - composit, 2 - profile
if element.modelElemStructureType == 1:
    element.composite = number_att_composit
else:
    element.buildingMaterial = index_attrib_build_mat
    
ChangeWall(element)
Attachments
find different parameters.jpg
#304482
Petar.Pejic wrote:That is a great tip, thank you for sharing your knowledge!
Additional question, how do you get string for the name of the specific composite / building material or anything else rather then the number? What would be the logic behind it?
Well the first thing that came to mind:
Code: Select all
dict_comp_wall = GetAttributeDictionary(API_CompWallID)
index_attrib_composit = 19

for key, attribute in dict_comp_wall.items():
    if index_attrib_composit == attribute.index:
        print(key, attribute.name)
Accordingly as a parameter name (attribute.*) can be anything that refers to it
http://archicadapi.graphisoft.com/docum ... _attr_head

P.S.
By the way key may not match index. Be careful
Last edited by mr.Mikhail on Tue Dec 03, 2019 11:27 pm, edited 1 time in total.
#304523
I've been experimenting with the python functions and ran into a problem with the CreateText function. I was trying to duplicate the the rich text example in the Element Test example add_on.

The problem is that the structure used - API_ParagraghType - uses as its first value 'from'. This is a keyword in Python and is a error if used as a variable. Is there any workaround for this problem? Anyone have any code to duplicate the rich text example?
#304536
poco2013 wrote:
Wed Dec 04, 2019 1:47 am
I've been experimenting with the python functions and ran into a problem with the CreateText function. I was trying to duplicate the the rich text example in the Element Test example add_on.

The problem is that the structure used - API_ParagraghType - uses as its first value 'from'. This is a keyword in Python and is a error if used as a variable. Is there any workaround for this problem? Anyone have any code to duplicate the rich text example?
Please show the script, I almost understood :D
  • 1
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8