Jump to content

DomC

Member
  • Posts

    604
  • Joined

  • Last visited

Everything posted by DomC

  1. This example shows, how to list filenames and foldernames of a folder on your disk. Contains the following Custom Nodes: 1. "GetActFile" --> The Path of the active Vectorworks document. 2. "ListDir" --> Folder- and Filenames of a directory 3. "GetNextObject" --> Handy to grab objects directly out of the script short movie documentation: FileAndFolderList.vwx
  2. The Attached Vectorworks Document contains the following Marionette Nodes: 1. "GetNextObject" --> Put This in a Wrapper with another Object. This node Returns the next Object (Stacking Ordner) after this node 2. "PageBased_mm" --> Will return a Page Based mm value. Handy to create Page Based Objects 3. "InputCode" --> Allows to simply enter math operations or any other python code via the input field 4. "AttachUnit" --> Recursive (Supports nested List or Tuples) Node which multiply every number in the input node with a document unit based factor. 5. "Color" --> Input Node to Return RGB Value of the Node's color. A short movie documentation is available: https://youtu.be/KZ5-nqP_1wo Input Node Collection.vwx
  3. Looks like an exciting marionette project. Would like to click an additional "love it" for that brilliant rendering ... Did not known yet about that duplicate layer issue. But this looks as a very plausible explanation for my own frustration by using wrappers. Also I think, there is a problem by switching around connections inside a wrapper, where from outside the wrapper are getting the wrong parameter names. Worse still, to edit code (above all parameter names) inside a node, that is already connected to the network. I reported similar issues some weeks ago. Also that network (looks quite tidy) unfortunately is crashing, if I actualize all PIO Objects (that sometimes can help to fix a network). Copy Paste the "Working Layer" to a new file, seems to work. Just amazing results ....
  4. Great Getting mad. I got this too late ... I made a Marionette Script for this. Maybe interesting for you too. https://forum.vectorworks.net/index.php?/topic/47686-colorize-subtext-of-text-object/
  5. In this Example there are used some custom Nodes: 1. "GetSubstring" --> Search for a string inside another string and returns Position and count. This will be necessary to set them to a Text Style Resource. 2. "GetInsideChar" --> Returns strings which are inside specified characters (normally quote or double quote) 3. "GetSubstringExcludeQuote" --> Same as the first one, but it to not return text inside quotes 4. "GetNumberFromString" --> Search for Numbers inside a String. 5. "GetNextObj" --> Put This in a Wrapper and it will return the next object after this node. This is a great one!! Can be used also for input geometry inside a script network. Without naming or other smut. This could be improved by further code (find standalone or text in word, find integer, find float, etc.) But It works for most cases perfectly. Youtube Link: https://youtu.be/OBuTtM1bGEc File: ChangeTextColor.vwx
  6. Some more slider loft surfaces with confirms to the same, simple principe. LoftSurfaceSlider2.mp4 LoftSurfaceSlider2.vwx
  7. The attached Marionette example shows, how to renames resources from the active document. It contains several custom nodes: 1. "TypePopup" : An Input Node, which translate a readable popup (Line, Rectangle, ImageFill etc. ) in the internal used index number (VectorScript appendix) 2. "GetRes" : This Nodes, collects the specified resource type from the active document. 3. "ReplaceString" : This node, replace any part of a string (text) input with a new string This example could be used for sorting and organize mass of ressources. - Find/Replace Text (or Characters) in the resourceName - add prefix or suffix to the name (As example .sym to symbols to clear names or prefix with the building number etc.) - produce an index number to a name for sorting - etc. RenameResources.mp4 RenameResouces.vwx
  8. Cool, you working on this ! I made a short Test: 1. Works perfectly on NURBS Curves and Surfaces 2. Your solid part I did not unterstand the first look. Looks like you re-model the bounding box of the solid with 3D Polys? I think the final solution had to be, to process every object Type in a different "Reshape" function. As example an extrude, we had to go inside the extrude, check the exact position of the Planar part of the extrude and reposition the points. Also there had to be a check, in which direction the planar part has to be reshaped etc. Also a problem is, how to make z-value changes user friendly enough. Maybe there had to be fixed direction "Reshape Cubes" instead of Reshape Polygons. A hard work in progress .... Thanks for posting.
  9. A small example which uses the control-geometry as a profile for a loft surface. Build up with nodes of the standard content. LoftSurfaceSlider.mp4 LoftSurfaceSlider.vwx
  10. This is a temporary result to the target usecase which should automatically visualize parts, data, devices etc. out of an external source or from data directly out of the drawing. This Example just imports an adress list and puts them on labels. Unspectacularly, something you can do with every text-processing software. But imagine what else we can do with Marionette ... LabelsFromTextfile.zip
  11. This example collects data from a worksheet and put them on a grid of labels. The label itself uses a template (as example a symbol), which contains placeholders with the name of the column titles. Special Nodes: 1. CodeInput-Node: This is a simple Node which have inputs and can handle them in a single-line code) This is a way to integrate directly text-code into a marionette script. Input formulas like "(a-b*2-(c-1)*d)/c" by single math nodes was a nerfing "waste of place" for and it feels so much better with that "CodeInputNode". 2. ListToLabel Node: This takes a List of Data and replace text in a textblock with that data. The Textblock contains placeholders. Some kind you know from Word Form-Letters. Label From Worksheet.vwx
  12. Hi Carlos I also failed by doing this. I found a way that works for me: 1. Converting the external images to the Arroway format. 2. Manually select the "Import Arroway Materials" menu command. (I hope this function is part of your Vectorworks version) Maybe this also can help you to realize your project. The Python Script: #DomC import os import shutil; import string FileList = [] major, minor, maintenance, platform = vs.GetVersion() isMac = False if platform == 1: isMac = True err, path = vs.GetFolder( 'Ordner mit Bildern auswählen' ) if err == 0: # no-error hsfPath = path if isMac: ok, hsfPath = vs.ConvertPosix2HSFPath( path ) Index = 1 while True: # loop the files fileName = vs.GetFilesInFolder( hsfPath, Index ) Index += 1 if fileName == '': break if fileName[0] != '.': FileList.append(fileName) n=1 for i in FileList: file, file_extension = os.path.splitext(i) folder = path+str(n)+'_'+file os.mkdir(folder, mode=0o777,dir_fd=None) shutil.move(path+i, folder+'/'+file+'_d100'+'.png') n=n+1 And if you want to rename the materials: Bild_liste,numItems = vs.BuildResourceList(97, 0, 0) #97 steht für Material, die anderen Nummern, siehe Vectorscript Appendix for bild in range(numItems): b = vs.GetResourceFromList(Bild_liste, bild+1) name = vs.GetName(b) #name = name[8:] newName = name[8:]+'.MAT' vs.SetName(b, newName)
  13. In this Example there are used some custom nodes: 1. ObjectOnSpace (Returns objects which are on or beside a space) 2. A modified "GetRecField" to handle List input 3. Export PDF Node Some Time-Saver-Nodes to reduce Network size: 1. Enhanced BoundingBox 2. Conde Input Node (Flexible Input Node to handle 4 input variables) 3. PutByRef Point (Move on a Target Point) PDF_Thumbnails.vwx
  14. Another example for a Marionette productivity-tool. The Attached Marionette Network imports all .skp Files from a chosen or predefined folder as Symbols. Limitations: - No special characters like äöü (I think a limitation of the vectorscript function) - No Sub-Folders This is a fore-taste of a couple of nodes I did the last weeks for import/export data or mass-modification of resources. So stay tuned ... :-) DomC BatchImport SketchUp.vwx
  15. Thanks for feedback That comment certainly was wrong ..., sorry :-)
  16. Hi Hm, I think your main problem is, you overwrite the handle (w1 = vs.LNewObj()) of your first wall. So you don't have it anymore, to join your last wall. You somehow have to copy the handle of the first Wall. I made a Script with a more flexible (which would be more flexible with more walls) script, that would work for me. It first loops the input points and draw the walls. Simultaneously it put the walls and points in another list-variable (named walls) with all values needed to joint them anytime later (point and handle). Second it loops through that wall-list-values and do the join job. Always the last point from actual(i) wall with first point next(i+1) second wall, and so on. i is the "loop counter". Loops and list variables are extremly powerfull instruments for scripts. Maybe it looks more complicated in your eyes like your original script. wv = [[0,0],[0,10],[10,10],[10,0],[0,0]] walls=[] for i in range(len(wv)-1): p1=wv[i][0],wv[i][1];p2=wv[i+1][0],wv[i+1][1] vs.Wall(p1,p2) w=vs.LNewObj() walls.append([w,p1,p2]) if i == len(wv)-2: #append first wall again to have a join object for the last wall walls.append([walls[0][0],walls[0][1],walls[0][2]]) vs.AlrtDialog(str(walls)) #Debug for errors, delete if it works for i in range(len(walls)-1): w1 = walls[i][0] w2 = walls[i+1][0] p1 = walls[i][2] #second point from actual (i) wall p2 = walls[i+1][1] # fist point from next (i+1) wall vs.JoinWalls(w1,w2,p1,p2,2,0,1)
  17. Hello Got It. It's so easy and it's supported from Marionette by default. I found it on the developper manual. Localiced name is the cue :-) http://developer.vectorworks.net/index.php/Marionette_Implement_a_Node And it works. Nice! this = Marionette.Node( "GetRNames", 'GetRNames\r'+VersionChange1+'\r'+VersionChange2) #this works Also we can make multiple lines for port names. We should nod overdo that, but it's possible. So I got a exact time stamp visible directly on the node. Or we can make nodes as compact as possible.
  18. That info is helpful. So im going back to things that are more promising :-) thanks
  19. Hi I want to integrate a last-edit-time directly in the node name. I did the year and month in the name of the node. And the exact time with minutes and seconds as a static text in the info palette. That works so far. But Nodes getting too big if Names are long. So I tried to insert a carriage Return (\r) in the Node Name to make a two line name. The Marionette backend seems to not loop that through the code. Is there any possibility to make a new line in a Node-Type Text? GetRNames.vwx
  20. One of my dozens of unshared litte Play-Examples. Special Nodes: - Absolut Dimension input Node - Datetime Input Field ob Application : KnowHow and Fun widget_watch.vwx
  21. Maybe I found another (better) Way to predifine Parameters inside the Marionette Script: def script(self): vs.AlrtDialog(vs.GetName(self.Handle)) #Handle seems to be correct fieldvalue = "{'data' : [{'varName' : 'param1','text' : 'p1','type' : 3,'description' : '','valueType' : 3,'value' : 500,'minvalueType' : 0,'maxvalueType' : 0},{'varName' : 'Int','text' : 'Button','type' : 16,'description' : 'script','valueType' : 6,'value' : 'script','minvalueType' : 0,'maxvalueType' : 0}]}" vs.CreateText(fieldvalue) #Test vs.SetRField(self.Handle,'MarionetteNode','NodeDef_OIPControls',fieldvalue) It seems, a record field inputs all parameters with python dictionary as a RAW string object. Just to find out, what kind of quotes and escapes there has to be. I think a Question of Quotes, Escapes and brackets. Hm .. give that up. The good old user-database is maybe the perfect thing to tag objects for marionette integration.
  22. Hi My Idea is, to save parameters inside a Marionette Script as a TextBlock, xml Text Block etc. doesn't matter. What a Marionette script is able to do, is to have access to objects inside the script and take them for use. Examples: 1. self.Params.y.value = vs.FInGroup(vs.GetParent(self.Handle)) Get the first Object inside a Wrapper self.Handle is the node, the code is running "Parent is the Wrapper" and so on. The new Button Feature, could show a nice Dialog Box in which I could set-up the Marionette script (And do not run every time we run the script, just by clicking on it something happens). The Idea is, to change something inside the marionette Script with the new "Button" Feature. The Button Feature executes a script which seems to run in another class, than the RunNode. Or something like this I do not understand. If someone here with deeper Python Knowledge could explain that, this would be great. @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( 'GetInputNodeHandle' ) this.SetDescription('') text = Marionette.PortIn( vs.Handle(0) ) text.SetDescription('The text object to pull the string from') Int = Marionette.OIPControl( 'Button', Marionette.WidgetType.Button, 'script', 'description') str = Marionette.PortOut() str.SetDescription('The resulting string') def RunNode(self): text = self.Params.text.value self.Params.str.value = vs.GetText(text) vs.SetText(text,'HelloRunNode') def script(self): input = self.Params.text.value vs.AlrtDialog(str(vs.GetType(input))) vs.SetText(text,'HelloButton') Also tried with "return text" inside the RunNode. And then input = RunNode(self) and so on. It seems, like it's not so easy to access with the "button" to the script itself. So what kind of use could have this Button exactly? Maybe to show a Hint or a Manual for the Script? Known Workarounds: With this Button, we could Handle to an instance, like a named Object or a Symbol, which contains the script content. That would be an indirect way to make this Button be something to change the script parameters. Also the button will not work inside a wrapped script. Someone can explain this too? ButtonIntegration.mp4
  23. Hi Mathias With pleasure ... Edit: Sorry, I uploaded wrong file. This is the correct one. Symbol on Space.vwx
×
×
  • Create New...