Experimental Python add-on is available for Archicad 23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-07-19
11:22 AM
- last edited on
‎2022-10-05
01:24 PM
by
Daniel Kassai
See the blog post on the developer site: https://archicadapi.Graphisoft.com/experimental-python-add-on-for-archicad23
Good luck!
Akos
- Labels:
-
Automation (Python or JSON)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-04 01:18 PM
typedef struct { Int32 from; Int32 range; API_JustID just; Int32 filler_1; double firstIndent; double indent; double rightIndent; double spacing; API_TabType *tab; API_RunType *run; Int32 *eolPos; Int32 filler_2; double width; double height; double filler_3[2]; } API_ParagraphType;Note: that the first variable, a Int, is named "from" which is a keyword in Python and not usable for reference.Therefore,it's not possible to create a wrapped paragraph python object.The actual code would parallel the example for "rich text" shown in the Element_Test example Add On. BUT its not now possible to create a paragraph object because of this conflict. Any workarounds? (Other than breaking the document up into separate draw segment, which would be a PITA) It might be simpler if Graphisoft would implement HTML or the other inline web format such as "markdown"?
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-04 05:39 PM
poco2013 wrote:If I understand correctly you are trying to create plain text, the only thing I know can be seen in "DoElementTest.py"
To describe a text paragraph, one must use the API structure of API_ParagraphType which would normally be wrapped as a APIObject() in Archicad's Python. The structure is:
Note: that the first variable, a Int, is named "from" which is a keyword in Python and not usable for reference.Therefore,it's not possible to create a wrapped paragraph python object.The actual code would parallel the example for "rich text" shown in the Element_Test example Add On. BUT its not now possible to create a paragraph object because of this conflict. Any workarounds? (Other than breaking the document up into separate draw segment, which would be a PITA) It might be simpler if Graphisoft would implement HTML or the other inline web format such as "markdown"?
def DrawText(x, y, text): element = APIObject() element.head = APIObject() element.head.typeID = API_TextID element.head.hasMemo = True element.loc = APIObject() element.loc.x = x element.loc.y = y memo = APIObject() memo.textContent = text return CreateText(element, memo)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-04 07:07 PM
guid = ClickElement()
element = GetWall(guid)
structure, where one could type element.List() in order to get information and idea what properties one could use. However, how do you apply that to other objects in archicad? How would you get for example window instead of wall, when there is not GetWindow (guid) function, or GetDoor(guid) or anything similar? Or am I missing something? I was not able to find GetWall(guid) function neither in the help file.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-04 07:45 PM
If I understand correctly you are trying to create plain text, the only thing I know can be seen in "DoElementTest.py"Nope -- I am trying to recreate "rich text" or as Graphisoft defines it - "multistyle Text". Multistyle uses a API_ParagraphType structure which , as i mentioned can not be used in Python because of the use of the "from" keyword.
Windows 11 - Visual Studio 2022; ArchiCAD 27

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-04 10:31 PM
Petar.Pejic wrote:FYI-- There is no GetWindow/GetDoor implementation YET in Archicad's Python. Since this only a experiment I assume that only a representative sample of functions were provided and more is yet to come.
I would like to ask for an additional qualification regarding getting information about elements. In previous example mr.Mikhail suggested using
guid = ClickElement()
element = GetWall(guid)
However, note that the API GetElement function returns the parameters of the element. Properties describe the element. In many cases the element's parameters are duplicated in it's 'builin' properties. You may find what you need in looking through the door/window properties which you can do using the python function:
GetElementPropertyDefinitionDictionary(elem,filterID) The filter should be set to '....._All' which will give all the BuiltIn properties. May not be what you need but worth a look?
Windows 11 - Visual Studio 2022; ArchiCAD 27
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-05 07:58 AM
Petar.Pejic wrote:There is an example "ListClickedElementMembers.py".
I would like to ask for an additional qualification regarding getting information about elements. In previous example mr.Mikhail suggested using
guid = ClickElement()
element = GetWall(guid)
structure, where one could type element.List() in order to get information and idea what properties one could use. However, how do you apply that to other objects in archicad? How would you get for example window instead of wall, when there is not GetWindow (guid) function, or GetDoor(guid) or anything similar? Or am I missing something? I was not able to find GetWall(guid) function neither in the help file.
Inside is used
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-05 08:06 AM
poco2013 wrote:I understood. Sorry, I still do not know English well and the translator does not always help
If I understand correctly you are trying to create plain text, the only thing I know can be seen in "DoElementTest.py"Nope -- I am trying to recreate "rich text" or as Graphisoft defines it - "multistyle Text". Multistyle uses a API_ParagraphType structure which , as i mentioned can not be used in Python because of the use of the "from" keyword.

Probably have to wait for individual functions to work with multitext.
As with many others.
I tried, something to throw on API_ParagraphType, but without successfully
UPD. If it helps. See attachment
UPD2. API_ParagraphType should be passed to memo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-05 08:46 AM
I need for a presentation why Python is needed for ARCHICAD. What it gives, why it is needed and what can be done with it.
After all, there is GDL and C++.
I've already broken my mind.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-05 08:59 AM
mr.Mikhail, what sort of help you need?
Edit: ListClickedElementMembers.py seams to work only for walls, it does not recognize any other elements when clicked (windows, doors, columns, roofs, slabs). Only walls. Is it just me, or others have that issue as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2019-12-05 09:05 AM
Petar.Pejic wrote:Write a list for the presentation.
Thank you all for explaining that in more detail.
mr.Mikhail, what sort of help you need?
- Why do you need Python for Archicad.
- What it can give or what it can do.
- What is the advantage over GDL and C++.