2019-07-19 11:22 AM - last edited on 2022-10-05 01:24 PM by Daniel Kassai
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"?
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)
2019-12-04 07:07 PM
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.
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)
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.
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.
2019-12-05 08:46 AM
2019-12-05 08:59 AM
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?