MRoth Posted July 11, 2022 Share Posted July 11, 2022 Hi I would like to build a translator. It should refer only to the document structure. Texts placed in the document can be disregarded. The rest should be translated. For this I have encountered some problems. - Is there an easy way to generate a list that contains all symbols, wall styles, line types, folders, etc.? - What kind of object has the object type 57? I found it by examining the parent object of a folder. Unfortunately, it is not listed in the appendix. - Similar to point 1: Is there a way to loop through all data visualizations. Again, unfortunately, I have not found any documentation. Thanks in advance for the help. Quote Link to comment
Pat Stanford Posted July 11, 2022 Share Posted July 11, 2022 As far as I know Data Visualizations are not currently scriptable as of VW2022. For Resouces that are present in the drawing, but not use on an object in the drawing you will need to take a look at one of the four BuildResourceList functions to make a list and then walk that list. I think you will have to do each type of resource you are interested in separately. I am not certain if you can get a list of folders directly, but I think you can return the full path of a resource so you can probably extract the required folders from there. I don't know what object type 57 is. Based on something I saw in the SDK, it might be a Container Object Header Node, but I don't know what that means from a file structure basis. 1 Quote Link to comment
Nicolas Goutte Posted July 12, 2022 Share Posted July 12, 2022 16 hours ago, MRoth said: - What kind of object has the object type 57? I found it by examining the parent object of a folder. Unfortunately, it is not listed in the appendix. The object types are documented for the C++ function ISDK::GetObjectType: https://developer.vectorworks.net/index.php/VCOM:VectorWorks:ISDK::GetObjectType 1 Quote Link to comment
MRoth Posted February 8, 2023 Author Share Posted February 8, 2023 First of all, sorry for the late reply. The answers helped a lot and the problems could be solved as far as possible. However, new ones have arisen. - With the code from below I try to retrieve all database entries of an object that are stored as text. out = [] for rec in range( vs.NumRecords(obj) ): r = vs.GetRecord(obj, rec + 1) r_name = vs.GetName( r ) fields = [] for fld in range( vs.NumFields(r) ): if vs.GetFldType(r, fld) == 4: fields.append( vs.GetRField(obj, r_name, vs.GetFldName(r, fld) ) ) out.append( fields ) However, this works almost too well, because I also get the IFC data output. In a format that I do not understand, however. [0] = ['{F32360E8-A72D-11ED-8823-0050B6F558F1}', 'GlobalId', '', 'OwnerHistory', '0', 'Name', 'abc', 'Description', '', 'ObjectType', 'Unstyled Wall', 'ObjectPlacement', '0', 'Representation', '0', 'Tag'] [1] = ['42dB'] Is there a way to sort out IFC databases and retrieve the database fields from there separately? - While trying to get a list of all sketch styles I ran into some unexpected behavior. I create the list with the following (greatly simplified) code. def content(type, n): MyList, NumItems = vs.BuildResourceList(type, 0, '') list = [] for i in range(1, NumItems + 1): name_old = vs.GetNameFromResourceList(MyList, i) #h = vs.GetResourceFromList(MyList, i) list.append(name_old) #END for return list #END def zubehör = content(47, 'Linienart') The object type 47 in the last line I get from Marionette. But this object type represents record definitions and not sketch styles. And the record definitions are also output by the upper code and in the output no sketch style appears. Does anyone know where my error is? I also can't find an object type for sketch styles in the appendix. Is it possible that they are handled internally as a record definitions, but the listing recognizes that it is a sketch style and therefore does not output it? Quote Link to comment
DomC Posted February 8, 2023 Share Posted February 8, 2023 Hi Maybe just the Variable Name "Zubehör" is the issue or return list. Try Changing the names of those two variable Names. list() is a python function and should not be used as a variable Name. Also special Character in function or variable names could maybe creates an issue somewhere. The rest I can't say much. You could test by renaming or deleting objects (take care about crashes) to see, where your handle is pointing to. Also caution with the nodes. If it returns None/Null maybe the print node attach the type to the prior object or something like this. I would first take the code out of the marionette nodes to search the bug. Quote Link to comment
MRoth Posted February 8, 2023 Author Share Posted February 8, 2023 Changing the names in zubehor and c_list doesn't change anything. And this code here deletes the sketch style after a 47 was displayed in the message. obj = vs.GetObject( 'Sketch style-1' ) vs.AlrtDialog(vs.GetTypeN(obj)) vs.DelObject(obj) Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.