Jump to content

MRoth

Member
  • Posts

    62
  • Joined

  • Last visited

Posts posted by MRoth

  1. What exactly should be the output? That you get an error here makes sense, because '390+10' is a string and therefore could not be converted. You would have to separate the numbers, then convert and add them. Or you simply use a function-node with the function eval(x).

     

    Was genau sollte den der Output sein? Dass du hier einen Fehler erhälst, macht Sinn, da '390+10' ein String ist und folglich nich umgewandelt werden könnte. Du müsstest die Zahlen trennen, umwandeln und addieren. Oder du brauchst einfach ein Function-Node mit der Funktion eval(x).

  2. I'm not sure I understood you correIch bin nicht sicher, ob ich dich richtig verstanden habe.ctly. (My English isn't so good.)


    But if I understand you correctly, the network below will work.

    grafik.thumb.png.26edf93206ce5a35a05c1363dafffdc4.png

    • Like 1
  3. Your problem is not the control geometry node. It returns the geometry of the marionette Objekts.


    The problem is that the locus node gets both 2D and 3D inputs and it can't handle it (for whatever reason). Simply convert the 3D points to 2D points and your network will return the desired points.

    grafik.thumb.png.051554a8b1a8515377966af8ef65d1be.png

    But you still get some points that are at the same location and the divide curve node deletes the polygon. But you can solve these points with some dataflow/math nodes and a duplicate of the polgon.

    • Like 1
  4. Hi @AlHanson

    I changed the if node a little bit, so that it can fix your problem now. With the third mode you have to be a bit careful because it reacts to the number of inputs on the test port. Otherwise everything should work fine.

     

    Unfortunately I can't send you a document with a finished node, because I use a student version and you wouldn't be able to open it.

    To implement, simply replace the code in the if node with the code below.

     

     

    Another way to solve your problem is to convert the list to a tuple, which you leave through the if node. Then you convert the tuple back to a list. I think you can find the corresponding nodes in DomC's node gallery. If you can't find them, just tell me and I can send you my version.

    #MRoth 200129
    
    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    #APPEARANCE
    	#Name
    	this = Marionette.Node( 'If enhanced' )
    	this.SetDescription( 'If test is true, pass the inputs from true otherwise pass the inputs from false' )	
    
    	#Input Ports
    	true = Marionette.PortIn( None, 'itemTrue' )
    	true.SetDescription( "An item" )
    	false = Marionette.PortIn( None, 'itemFalse' )
    	false.SetDescription( "An item" )
    	test = Marionette.PortIn( True, 'bTest' )
    	test.SetDescription( "A boolean value" )
    
    	#OIP Controls
    	opt = Marionette.OIPControl( 'Options', Marionette.WidgetType.RadioButton, 3, ['Value', 'List', 'Automatic'])
    	opt.SetDescription('Select how the node should work. ' + vs.Chr(10) +
    	'"Values"=Works like the standard node; ' + vs.Chr(10) +
    	'"List"=Returns the list in its original length; ' + vs.Chr(10) +
    	'"Automatic"=If only one value is entered for Test, the node acts according to the List mode, and if several values are entered, the node acts according to the Value mode.') 
    
    	#Output Ports
    	out = Marionette.PortOut('item')   
    	out.SetDescription( "The result item" )
    
    #BEHAVIOR
    	this.SetListAbsorb()
    	
    def RunNode(self):
    	#libraries
    	import itertools
    
    	#inputs
    	test = self.Params.test.value
    	true = self.Params.true.value
    	false = self.Params.false.value
    	opt = self.Params.opt.value
    	
    	#script
    	b = False
    	if opt == 2 and len(test) == 1: b = True
    	
    	if opt == 0 or not(b):
    		maxi = max(len(test),len(true),len(false))
    		
    		test = test + list(itertools.repeat(test[len(test)-1], maxi - len(test)))
    		true = true + list(itertools.repeat(true[len(true)-1], maxi - len(true)))
    		false = false + list(itertools.repeat(false[len(false)-1], maxi - len(false)))
    		
    		out = []
    		for t in range(len(test)):
    			if test[t]:
    				out.append(true[t])
    			else:
    				out.append(false[t])
    			#END if
    		#END for
    	else:
    		if test[0]:
    			out = true
    		else:
    			out = false
    		#END if
    	#END if
    	
    	#outputs
    	self.Params.out.value = out

    (Sorry for my scripting style. I don't know Python that well yet and have helped me with what I already know. Surely there are nicer ways to solve the problem.)

  5. Hello everybody

     

    In the German version the DialogBuilder was installed from VW2020 on and now I had to try how it works. Thereby I stumbled over some questions and would be really glad if someone could help me with it.

     

    1. How can I fill a drop-down list with values?
    2. Can I get the strings from an other place than the automatically generated .vwr?
    3. Certain elements of the dialog are changed during the display. For example, clicking All changes the checkboxes. Where can I create these functions?
    4. How can I call the dialog from my plug-in?
    5. How can I reuse the return values of my dialog?
    6. How can I map a listing of all layers? The problem here is not listing, but mapping in the dialog. This is problematic for me because the number of layers is not fixed. Therefore I would have to map a variable number of text fields, which I still fail with the dialog builder. Another complicating factor is that I want to have a field with editable text next to the layer name. Is such a thing possible or do I have to do without the dialogbuilder?

     

    The tool is absolutely ingenious and makes the creation of dialogs much easier.

     

    It does not matter if not all questions can be answered. If I get an answer to the most important and easiest ones I am already happy.

  6. To customize the default dropdown node "Popup", you have to remove the first line of code and then change the elements of the list in line 13.


    The example below shows a dropdown with the elements car, train and plane.

    @Marionette.NodeDefinition
    class Params(metaclass = Marionette.OrderedClass):
    #APPEARANCE
    	#Name
    	this = Marionette.Node( 'Popup' )	
    	this.SetDescription('This node shows a dropdown with the elements car, train and plane. The values returned by this node will be integers based on your selection starting with 0 for the first option and increasing by 1 for consecutive options.')
    	
    	#Input Ports
    	
    	#OIP Controls
    	input = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['Car', 'Train', 'Plane'])
        
        #continue with the standard code

    Remember that this node outputs integer values. so in the example above I added an Any-node with the selection list and a GetItem-node.

  7. A simple way to accept custom inputs in addition to the default values is to add a "Use custom value" entry to the dropdown. In addition, you need an input field in which you can do the custom input. Now you can choose with a simple "if" whether the value of the dropdown or the custom input should be used.

     

    grafik.thumb.png.01371eebf1c9e1c5cb96cd6a423812f3.png

    I know you don't want to see a ready-made solution, but with a picture, it's easier to understand.

     

     

    • Like 1
  8. Hello everybody

    I would like to create a menu command that works with selected objects. For this I use Objects by Criteria-Node. However, I'm not quite comfortable with the settings. What I want to do is always work with the currently active objects. One difficulty is that I only want to edit objects that I could edit with the computermouse at the moment. This means that when I am working in a group, selected objects outside of this group should not be listed, but those inside the group should be appear. The same goes for layers. Selected objects that are on another invisible layer should not be listed.

    What are the settings for this?

  9. I know that it isn't possible to assign opacity to a VP. That's why I try to create a layer override with the desired opacity.

     

    grafik.thumb.png.d8e50b76ba0ff80b080dc653590e2f42.png

    Deckkraft = opacity

     

    The first script in the attached file should create a layer override for the layer EG-Arch.

    The second script should create a layer override for all visible or gray layers.

    The viewports on the right side shows the result I like to have. But it does not work the way I want.

  10. Ok, let me try this again.

     

    1) Here I found out that vs.SetObjectVariableString() does not work. Or at least it does not work with the indices 1 to 1'000'000. If there is another idea of how code in a node can be changed, I would be very grateful to hear from it.

     

    2) Here I can post a node of which I thought would work. But he does not. Does anyone know what I'm doing wrong?

    Verlauf.vwx

     

    3) For the third project I've found another solution without marionette.

  11. Hello everyone

     

    I have some marionette projects where I am currently working on.

     

    1) I want to build a translator tool for marionette nodes - of course with marionette. This because my English is about as good as that of the Google Translators (I think you’ll notice it) and I would consider not at each node a bit more specific what exactly this node does. So, a Translator would be nice.

     

    This network should be able to translate an existing network. I see two possibilities for that.

    a) The script is rebuilt with new nodes. The connections between the nodes could be very complicated with this solution.

    b) The code in the nodes is changed. I think this version is more realistic, have gladly corrected me.

     

    In order to implement b I would have to be able to edit the script in the node. Is that possible and if so how? A set node would suffice, because I can read out the names of the nodes from the content on the drawing.

     

    For the translations, I'm still undecided how I best save them. In a database, as texts in the drawing or in string nodes? If it should, be possible to read the script of the nodes, the translations could be stored also in nodes. (But that's probably a little far.) What is the best way to store such a large amount of strings?

     

     

    2) On my second (and hopefully a bit easier) project

     

    Here, I want to change the transparency of a viewport. This works no longer via the attribute palette (I think in VW18 it still worked) To accomplish this anyway, the transparency of the displayed layer would have to be changed. I found a function in the DevWiki, which probably could do this. (SetVPLrOvrdOpty). But I am not able to implement this function in a node so that VectorWorks doesn't crashes when running the network. Maybe someone could help me here as well.

     


    3.) And for the last project. I want to capture the objects from a design layer (not sure if the this is the correct name. In any case, the layer with the planheads) in a PIO and then rotate and move them. The resulting PIO will also be on a design(?) layer. However, moving the viewports (and possibly other objects. I could imagine that groups are too hard to move.) does not work. Is there a good solution to move all 2D-objects? I also tried move-nodes from @DomC but they all fails. (even the Move 2D-Node)

    Sadly, this problem has to be solved by a PIO, cause viewports referencing on a design(?) layer are not possible. If this would be possible this project would be useless. This project has the lowes priority for me. It's just a nice-to-have.

     

    Thank you for your help.

     

    Manuel

     

     

    PS: Please excuse my bad English. I try hard.

×
×
  • Create New...