Jump to content

MRoth

Member
  • Posts

    65
  • Joined

  • Last visited

Posts posted by MRoth

  1. 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)
  2. 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?

  3. And here is the automatic translation, for all those who have the same problem again. Uncontrolled from DeepL.

     

    Hello Flo,

    you don't necessarily need to program this in the script.
    It is enough to think of a clever filter that you can use in the table.
    I have put a part of the Marionette objects in another class (as a filter then the class taken) Marionette object name I tried but did not get to run.
    If this is not enough you have to rewrite the script to check if the values exist.

    But I personally don't like the solution with the script.
    It would be easier to attach a database to the puppet objects and to write the desired "parameters" in the puppet object directly into the database.
    Then you can also "capture" everything possible in addition e.g. the area of the rectangle etc.
    Tip:
    With the node "Parent Pio or now ("Marionette Object" in VW2023) you get the data to the Marionette Object.
    Without it, the data are attached to the rectangle in the marionette object.

     

    Greetings Markus

    • Like 2
  4. 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.

  5. Maybe I have an idea. But I'd like to run a few tests of my own before I promise too much.

     

    For these tests I would need some more details.

     

    - It seems as if you always fill one half of the shelf with plates and the other with glasses and bowls. Is that correct?

    - What are the diameters of your dishes?

    - Are there any specifications for your shelf regarding size? For example, only with certain depths?

  6. Are these all individual objects that can be placed completely randomly or would it be possible, for example, to pack the glasses in a predefined block. This block would have a length that could be used again.

  7. At the node level this can't work as far as I know. But mostly a loop can be bypassed. In your case you could divide the length of your shelf by the width of your objects and get the number of objects that fit into your shelf. Now that you know how many objects it takes, you can use a range node and some math to calculate the insertion points and then place the objects.

     

    With objects of different widths it gets more difficult, but there should be a solution here as well.

    Otherwise you will not be able to avoid a user-defined node.

     

    Is this about your books or another project?

  8. Because I am using a student version, I can't send you the finished node. So here's the code that does what you want.

    #MRoth
    #V1.0 20200523
    
    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    #APPEARANCE
    	#Name
    	this = Marionette.Node( 'Get Part Min' )
    	this.SetDescription( 'Break the list into a list of lists of length n' )
    
    	#Input Ports
    	inList = Marionette.PortIn( [], "list" )
    	inList.SetDescription( "The input list" )
    	n = Marionette.PortIn( 1, 'nStep' )
    	n.SetDescription('Number of items per split list')
    
    	#OIP Controls
    
    	#Output Ports
    	list = Marionette.PortOut('lists')   
    	list.SetDescription( "The result lists" )
    	mi = Marionette.PortOut('nMin')   
    	mi.SetDescription( "The min value per list" )
    	bo = Marionette.PortOut('iIndex')   
    	bo.SetDescription( "A bool that indicates whether it is the min value in the list." )
    	ind = Marionette.PortOut('bMin')   
    	ind.SetDescription( "The indexes of all min values." )
    
    #BEHAVIOR
    	this.SetListAbsorb()
    	
    def RunNode(self):
    	#inputs
    	list = self.Params.inList.value
    	n = self.Params.n.value
    		
    	#script
    	n = n[0]
    	newList = [list[x:x+n] for x in range(0, len(list), n)]
    	
    	mins = []
    	bools = []
    	index = []
    	for x in range(len(newList)):
    		l = newList[x]
    		m = min(l)
    		mins.append(m)
    		for y in range(len(l)):
    			item = l[y]
    			if m == item:
    				bools.append(True)
    				index.append(n * x + y)
    			else:
    				bools.append(False)
    				
    	#outputs
    	self.Params.list.value = newList
    	self.Params.mi.value = mins
    	self.Params.bo.value = bools
    	self.Params.ind.value = index

     

    And here how the node is installed.

    grafik.thumb.png.137c428b833807d635d36af399f88f06.png

     

    There are certainly better ways to build the node, but the above one works, which in my opinion, is the most important thing.

    • Like 2
  9. How do you want to enter the values? In a separate dialog box.

    In this case I would recommend you to use CTRL + D [Duplicate] and then CTRL + (ALT) +  M [Move/Move 3D.

     

    If there schould be a command for each direction and length of movement, there will be six commands. But they are quite easy to create.

  10. Hello everybody


    I'm looking for a function to set the color of a single character of a text.

    So exactly the opposite of GetCharColor.

     

    I want to install this function in a marionette node. That's why it would have to be a Python command.

     

    Thanks for the help.

  11. With your wish there are some problems which I could not yet solve or which might not be solvable at all.

    1. How should the values be stored? If they are saved in a text field, this is also visible in the finished MarionetteObject, which is in my opinoin a bit unattractive.

    2. When the button is clicked, the previous nodes are not processed. Therefore it is not possible to calculate the options. The dialog always shows the default values of the node.

     

    Therefor it is probably the better option to simply use a popup node.

    If someone still wants to continue working on it I have uploaded the approach for the node here.

    Popup Dialog on Click.vwx

     

    Same text in german

    Bei deinem Wunsch gibt es einige Probleme die ich noch nicht lösen konnte oder die eventuell gar nicht lösbar sind.

    1. Wie sollen die Werte abgespeichert werden? Wenn sie in einem Textfeld gespeichert werden ist dieses in dem fertigen MarionetteObject ebenfalls sichtbar, was in meinen Augen ein wenig unschön ist.

    2. Beim Klick auf den Button werden die vorhergehenden Nodes nicht ausgeführt. Daher ist es nicht möglioch die Optionen zu berechnen. Im Dialog werden immer die Defaultwerte des Nodes angezeigt.

     

    Von demher ist es wahrscheinlich die bessere Option einfach ein Popup-Node zu verwenden.

     

    Wenn trotzdem jemand weiterbasteln möchte habe ich den Ansatz für den Node hier hochgeladen.

     

    • Like 1
  12. 13 hours ago, GRZEGORZ said:

    The easiest way to create custom node is to modify existing one.

    Thats what i actually did.

     

    For the node above I used the Int-Node as base.This, because it was already on the drawing and (whats more important) the input and output ports are correct. The Int-Node and your node both have an integer OIP input and a single output. This means no new ports need had to be created. It is always an effort to create new ports and therefore much easier to reuse existing structures. For the same reason, the node is not completely rewritten. I always try to copy and reuse as much as possible. It's a lot easier.

     

    After deciding which node to use as a basis (A decision on life and death😂), I deletet the first codeline. Without this step it isn't possible to change the code. Then i copied your code into the node and made some changes to create the output list. Next step was to integrate the Integer-Input and replace 1.68 through the code into the phi-node. Last but not least the inputs got new names and descriptions.

     

    Between these steps there was always a test whether the node still worked correctly.

     

    All in all, the creation of the node took about 5 minutes. This also explains the bad descriptions.

×
×
  • Create New...