Jump to content

DomC

Member
  • Posts

    640
  • Joined

  • Last visited

Reputation

640 Spectacular

Personal Information

  • Location
    Switzerland

Recent Profile Visitors

33,556 profile views
  1. Hi My idea is to create a web server, host a dialog there, and exchange data via the web directory of the hosted content. So far, I see the following possibilities: 1. **Dump the site from Vectorworks to a local file.** Local web content is restricted and, as far as I can see, cannot contain cross-references or multiple files. This is for security reasons, as a web application shouldn't control the local file system. One way to address this is by using a local development server (e.g., Python's `http.server`) to serve the content over HTTP, bypassing these restrictions. 2. **Launch an Apache server on macOS.** This works so far; the site is hosted in a machine directory that is accessible with root privileges. It's quite simple to do with a `subprocess sudo apachectl start`. This would work, and the web application could load and write data in the directory. However, this requires root access to start Apache. Or having to manipulate configuration files. 3. **Launch a web server via Python.** Here, it’s not possible to launch it directly within Vectorworks because the server would block the Vectorworks main thread, as Python’s default HTTP server runs synchronously. 4. **Launch a Python web server as a subprocess and access the embedded Python in Vectorworks.** This could be possible, but the environment variables in the OS might not handle the embedded Python properly. Explicitly configuring the subprocess environment or using isolated Python installations could help mitigate this issue. However, it's possible that the embedded Python content is designed to run exclusively within Vectorworks, making this option challenging. bash python3 -m http.server 8080 5. **Installing additional application in the OS.** This is also possible, but the solution should work like a portable standalone application rather than requiring content to be installed into the system. Tools like Docker or portable Python distributions could make this approach feasible without impacting the system setup. 6. **Using an external web application to handle everything.** In this approach, you send a token, the web application processes the data (e.g., sanitizes and validates it), builds the site, and writes results to a database. The local script can then retrieve the results using the temporary token. I’ve used this method for some projects, and it seems very flexible and powerful. However, it requires an external web service and isn’t lightweight at all. 7. Creating one single local web-page Merging everything in one file would work for pushing the content into the site. Still the issue then, that it is not possible to write something on the disk, which would work with the #2 apache webservice. I know an SDK-developed application could make direct access possible (anyway i never tried this, too much respect from the c++ environment), even with a non-blocking palette. But still there is the other question of hosting the site on the localhost. Does anyone have additional ideas for a simple, secure and clean workflow to host the web-content?
  2. Got it vs.SetDLSeparation(separationDistance)
  3. Hi What i am trying to do is, change tool settings by script. The Following approaches i try: 1. SetSavedSetting() This works, but it seems it writes to the xml memory. And while closing Vectorworks the settings are wrote back to the file. Also i can set every setting i want as Example vs.SetSavedSettings('foo', 'bar', 100) It will store that setting 2. Second approach Writing the xml file. Which also works. It writes the value with my example. But after closing Vectorworks it will overwrite with the tool setting. any ideas? import os import xml.etree.ElementTree as ET # Hauptskript user_app_settings = vs.GetFolderPath(-15) tool_settings_file = os.path.join(user_app_settings, 'SavedSettings.xml') s_dialog = 'Einstellungen optimieren' #res = vs.YNDialog(s_dialog) import xml.etree.ElementTree as ET def modify_nested_xml_value(file_path, parent_tag, key, new_value): # Parse the XML file tree = ET.parse(file_path) root = tree.getroot() # Suche nach dem übergeordneten Tag und dann nach dem spezifischen Element innerhalb davon parent = root.find(f".//{parent_tag}") if parent is not None: element = parent.find(key) if element is not None: element.text = str(new_value) # Setze den neuen Wert # Speichere das aktualisierte XML zurück in die Datei tree.write(file_path, encoding="UTF-8", xml_declaration=True) vs.Message(f"Updated '{key}' under '{parent_tag}' to '{new_value}' in {file_path}") parent_tag = "DoubleLinePreferences" key = "Separation" new_value = "19" # Neuer Wert für Separation modify_nested_xml_value(tool_settings_file, parent_tag, key, new_value) vs.SetSavedSetting('DoubleLinePreferences', 'Separation', 20) res = vs.GetSavedSetting('DoubleLinePreferences', 'Separation') vs.AlrtDialog(str(res))
  4. The node is called color input not color rgb Normally the issue of disappearing objects it the 2D 3D Content that a PIO or a Symbol can have (do you have a PIO?) It also depends if you have screen plane or layer plane as default, where your 2D Objects are places inside a PIO. For better control of where Planar Objects are placed you can use Set Planar ref (0 is screen plane and will be 2D Component of PIO) or set component group. Also discussed here.
  5. 1. The Compose node uses a Menu-Command. It works as long as it is not used inside a PIO Object. The reason why it does not work is, that you do not create any lines which you could compose. Lines: 2. You try to create lines with start 0.0 and end 350.0. Instead you should insert a point (0.0,0.0) at start and end(350.0,350.0) as Example. 3. You have a list of points in the right order. You could create directly a polygon with the node "Create 2D Poly" Here two Variants to create the polygon. I would choose Variante B it the rest of the network do not need lines somewhere. Just the poly This two Rectangles creates the same Polygon I mean 4 Nodes agains one single nodes which does the same (I counted the Attribute node in the Screenshot)
  6. Version 1.0.0

    22 downloads

    This node is the end of boring QR codes that anyone can make. With this node, the creative designer creates their own QR codes. There are endless design possibilities. But be careful: at some point, the QR code may no longer be readable by your smartphone. How it works: Enter the text (e.g., URL link) in the info palette, press Enter > done. Have fun with it! How it works: Enter the text (e.g., URL link) in the info palette, press Enter > done. Have fun with it!
  7. Version 1.0.0

    35 downloads

    This is an older but still fantastic marionette. The thing which is a little newer is the version of the poeple Crowd polygon which i never shared i think. With the following Features: 1. One big Focus Point where people crowding (Entrance, Food Track etc.) 2. Smaller Focus Points where people talk together etc. 3. The Script gets different symbol folders. It collects from a folder symbols in the focus arreas (waiting people, sitting people as Example) 4. Ant a different Folder for People which moving between the focus points To Make your people layout, you could combine more than one PlugIns with different settings. I think you need one PlugIn per Special Focus. i think this could also be used for trees, cows and other living objects.
  8. With look you mean the Attributes or the algorithm? 1. Well the Attributes depends on the classes and the classes depends on the different name of the matrial you have in your list. If you create the classes first, you can define the attributes before the script runs. 2. The Packing algorithm and settings of the PIO defined in the pio. You could test your settings first with a smaller list by input a smaller copy of your worksheet. And then for final calculation link your real-list. While it is a plug in you can only change one parameter at a time. It will recalculate after every change. Also maybe sort your list by materials. So you can work in etapes. 3. To prevent this. For your usecase you could double click the PIO, edit the script. copy the network. Then close file and reopen (because recalculation of script could take a while) then paste the script on the construction layer. Here you can change as many inputs values as you want and run the network manually. The script should run ourside the PIO without modifications, just delete the big rectangle in the background after creation
  9. DomC

    record name

    @Zuzzla Thanks for noting that. After all this is right. The node uses the key varName which represent the internal name. the key 'text' represents the visible parameter name. Because i use "if name in varName" and not name == varName it worked for me while i always not check with the full name. However the "text" key was the right one to use.
  10. If so i would not just loop the walls in drawing and changing the same stile hundreds of times. I would get the walls and collect the used style names. Then i would eliminate duplicate names and loop the style names. Or collect the Resources directly. Beside that, i would not change object swhich i collect with "ForEachObject" directly in the "ForEachObject" callback function. I would use "ForEachObject" always as a read only manipulation. something like this: wall_style_names = [] def get_objects(h): wall_style_name = vs.GetWallStyle(h) '''hinzufügen, falls nicht schon in der Liste''' wall_style_names.append(wall_style_name) if wall_style_name not in wall_style_names else None vs.ForEachObject(h,('T=WALL')) for wall_style_name in wall_style_names: wall_style_handle = vs.GetObject(wall_style_name) '''security to be sure just manipulating wall styles''' if vs.GetTypeN(wall_style_handle) == 127: #Do your component renaming code here
  11. Short Test. It works with an unstyled Wall. h = vs.FSActLayer() bool = vs.SetComponentName(h, 1, 'ciao') For a Styled Wall, it works by get handle of wall style and set it there:
  12. I think it is not possible the change the component name of a styled wall. Even manually we are not able to do so. Text is greyed out
  13. 1. Table with output boards would be possible by enhancing the script. But never heard before of that because you count the needed boards very fast. Also on your file. You need less than one board for every material. For what usecase this would be needed, would it save time or is it prevent misscounting? 2. Graphical Attributes. For ever Material autmatically a class is created and you can just change the class style to change the attributes. Note you have some Workpieces without a Material You have a class for Platten (Boards) and Teile (Parts). For the Text you had a Text-Style, but you deleted. Take it back from the Template. Then you can set Text Size and Text centered etc. Best looking Optimizing Software ever 🙂
  14. Not near my Mac. I Wonder if you handle the style or the Wall.
×
×
  • Create New...