Jump to content

Translator


Recommended Posts

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.

Link to comment

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.

  • Like 1
Link to comment
  • 6 months later...

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.

grafik.thumb.png.6201380017339cbb147fb6544fc17d9c.png

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?

Link to comment

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.
 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...