Jump to content

GioPet

Member
  • Content Count

    87
  • Joined

  • Last visited

Community Reputation

0 Neutral

2 Followers

About GioPet

  • Rank
    Apprentice

Personal Information

  • Occupation
    Architect RIBA Part2
  • Location
    United Kingdom

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Pat, Thanks for clarifying - does that mean there is no way to call the function 'Site Model from Source Data'? I've been looking to test calling the actual name of the plugin, but I can't even identify it... As part of a wider function, what I'm trying to achieve is to call up the 'site model' dialog to then generate a 3d terrain from selected 3D locus points. Any alternative solutions?
  2. Hi Nicolas, thank you for the response but unfortunately that doesn't solve it - i've tried with several indexes. Based on Vectorscript Function Reference, Terrain is the submenu so the following should work: vs.DoMenuTextByName('Terrain',1) But it doesn't work either..
  3. Hi, I am trying to call the function 'Site Model from Source Data...' found under the menu AEC>Terrain> I haven't been able to figure out how to call this using vs.DoMenuTextByName. Doing some digging, I've noticed that in the Workspace Editor the function is 'hidden' under the command 'Site Model Processor' Does anyone have any idea on how to go about this? Thank you!
  4. Hi both thank you very much for the input, I'll try both ways and see what I find out. I will post results/ideas here.
  5. Hi all, I am looking into setting VP visibilities through a script - as an example, I'd like to begin with turning off wall components in a viewport. Has anyone had experience with anything similar? In the Function Reference I could only find functions related to viewport overriders, but not to other visibility settings. any suggestion on how to tackle this?
  6. Hi twk! thank you for sharing this! I am a bit new to Python classes so this is a great stab at it - I love how dynamic it is! best
  7. Hi and thank you both! I found the solution in both the problems you've pointed out. for future reference, here are the steps i've gone through. The following is to work around the lack of the function SetClassN in VW versions prior 2018: Create List (or Dynarray if in VS) of Handles to Groups in the file change the Class of each Group through a for loop that takes each item in the list If the Layer of the Group is different from the Active Layer, the target layer is activated The Group is Selected, Ungrouped, Re-Grouped in the TargetClass The following code creates unwanted layers as well as unexpected Groups with different results. The issue is caused by a NIL handle creeping into the ExtendedGroup list - although I haven't figured out why this happens and its behaviour generates always different results... ExtendedGroups = [] def BuidlList(h): global ExtendedGroups GroupLayer = vs.GetLayer(h) if GroupLayer != vs.ActLayer(): ExtendedGroups.append(h) def Script(): criteria = '(T=GROUP)' vs.ForEachObject(BuidlList, criteria) vs.NameClass('None') #the TargetClass is be specified as intended for item in ExtendedGroups: layName = vs.GetLName(item) if layName != vs.GetLName(vs.ActLayer()): vs.Layer(layName) # here follows is a set of function, e.g. vs.SetSelect(item) vs.Ungroup() vs.Group() vs.DSelectAll() Script() As per Raymond indication - my logic would follow to exclude NIL items from being passed on to the for loop, thus adding these: for item in ExtendedGroups: if item != None: # all the functions to be performed - as above else: vs.AlrtDialog('Handle to Group is NIL!') I may be wrong, but I can't figure out why this logic fails - yet this still leads to unwanted results and additional layers... The only way I got it to work is to wrap the for loop in another loop that runs for each layer in the document: #after collecting all layer names in the document in a list named 'LayerList' for Lnames in LayerList: for item in ExtendedGroups: if item != None: # all the functions to be performed - as above else: vs.AlrtDialog('Handle to Group is NIL!') Thank you again for the suggestions!! It had become a headache..
  8. Hi Raymond, thank you for your response. I am actually writing this in Python - but it's all using VS functions. Here is a snippet of my code: for item in ExtendedGroups: layHand = vs.GetLayer(item) layName = vs.GetLName(layHand) vs.Layer(layName) vs.SetSelect(item) vs.Ungroup() vs.NameClass(TargetClass) vs.Group() vs.DSelectAll() This is a for loop that goes through the items (which are handles to Groups) in a list - equivalent to a DYNARRAY in VS. So I actually never spell out the name of the layer in the code - but if I run this on a file with a layer named 'Design Layer-1', the vs.Layer() function does generate a new layer called 'Design Layer-2'. The result of the script should be that it changes the Class of Groups in the file - instead it generates as many new 'Design Layer-x' as the number of items found in ExtendedGroups. I can't think of ways around this problem.. but I may be completely unaware of something I should know about this?? PS - thanks for the heads up with invisible characters! I use BBedit and turned on my Invisibles.
  9. Hi Joshua, thank you for your reply. I am modifying the objects through the script - amongst other things I need to Change the class of certain objects and realised that SetClass cannot retain the class of the objects within Groups!! SetClassN would do the job but it's available only since VW2018.. To move a Group from a class to another (achieving the equivalent of SetClassN), my workaround is: Activate the Group's layer Activate the desired class Ungroup and Group But the Ungroup function won't work when I parse the handle of Groups which are not on the active layer - so I tried to use the Layer function to switch to each layer and change the class, but I've hit the problem.. Can you think of any other approach to this?? I agree with your answer and I would always ensure layers are properly named, but I need to get this script to work in almost any scenario - including drawings by others..
  10. Hi all, this is a 'back to basics' question. Here is the problem I'm coming across: if the layer name ends with a number, the VS function Layer creates a new layer by incrementing the last digit. A simple example: layerName: 'Design Layer-1'; Layer(layerName); this will generate a layer named 'Design Layer-2' instead of activating the existing layer. I am using ForEachObject to parse a set of objects through particular function. Through the function, I need to activate the layer of the referenced object so that I can edit some of its parameters - but this won't work where layers end with a digit. Can anyone suggest a workaround to Activate the layer of an object in this situation?? is there any function to activate the layer through its handle or through a referenced object? thank you!
  11. Hi Pat, thank you for your reply. I have tried using the <Folder>MyPythonPackage</Folder> but when I run the encrypted vsm in a Vectorworks installation that has no bs4 library installed, I get the following: So this is not working... In my understanding, when you say 'look for the lib as usual package with py files and include these instead' isn't that done by adding all the py files of the library in the xml Package? in this way: <File>bS4/</File> <File>bS4/__init__.py</File> <File>bS4/.py</File> <File>bS4/diagnose.py</File> <File>bS4/element.py</File> <File>bS4/testing.py</File> <File>bS4/builder/__init__.py</File> <File>bS4/builder/_html5lib.py</File> <File>bS4/builder/_htmlparser.py</File> <File>bS4/builder/_lxml.py</File> thanks for your advice. Giovanni
  12. That's the case: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- This file defines how the corresponding script plug-in should be packaged--><Plugin> <Package> <File>Development/code/__init__.py</File> <File>Development/bS4/</File> <File>Development/bS4/__init__.py</File> <File>Development/bS4/.py</File> <File>Development/bS4/diagnose.py</File> <File>Development/bS4/element.py</File> <File>Development/bS4/testing.py</File> <File>Development/bS4/builder/__init__.py</File> <File>Development/bS4/builder/_html5lib.py</File> <File>Development/bS4/builder/_htmlparser.py</File> <File>Development/bS4/builder/_lxml.py</File> </Package> </Plugin>
  13. Hi Joshua, thank you for your response. Yes my user folder was set to /7_Vectorworks 2017, and I keeping the xml in the Plug-in folder within that. For clarity - I have know reverted back to the standard path and still keeping the xml next to the vsm. Indeed, I don't have a 'main.py' because all my code is in the vsm. The Encryption works with no errors, but when I run the Encrypted vsm on a different installation of Vectorworks I get the error: ImportError: No module named 'bs4' (bs4 module is the BeautifulSoup module) My python call in the script is: from bs4 import BeautifulSoup So something is not working in actually binding the package with the vsm file.. any idea? here is a screenshot of my Plug-in Folder with the Development/code and Development/bs4 folders. thank you Giovanni
  14. Hello, I have been working on a few Python Scripts that use third party libraries - for example BeautifulSoup4. I intend to Encryption this script into a vsm plugin so that the external libraries are bound to it and can be used on other installations of Vectorworks. I realised that the Encryption/Obfuscation method through Vectorworks is not able to bind the external packages into the vsm file: I've included the path to these libraries in the Script Options and I am using the steps indicated by Vlado in this post for the related xml file. <?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- This file defines how the corresponding script plug-in should be packaged--><Plugin> <Package> <File>code/__init__.py</File> <File>bS4/</File> <File>bS4/__init__.py</File> <File>bS4/.py</File> <File>bS4/diagnose.py</File> <File>bS4/element.py</File> <File>bS4/testing.py</File> <File>bS4/builder/__init__.py</File> <File>bS4/builder/_html5lib.py</File> <File>bS4/builder/_htmlparser.py</File> <File>bS4/builder/_lxml.py</File> </Package> </Plugin> Can any one advise on how to resolve this? Thank you in advance. Giovanni
  15. Hello, I have been working on a few Python Scripts that use third party libraries - for example BeautifulSoup4. I intend to Encryption this script into a vsm plugin so that the external libraries are bound to it and can be used on other installations of Vectorworks. I realised that the Encryption/Obfuscation method through Vectorworks is not able to bind the external packages into the vsm file: I've included the path to these libraries in the Script Options and I am using the steps indicated by Vlado in this post for the related xml file. <?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- This file defines how the corresponding script plug-in should be packaged--><Plugin> <Package> <File>code/__init__.py</File> <File>bS4/</File> <File>bS4/__init__.py</File> <File>bS4/.py</File> <File>bS4/diagnose.py</File> <File>bS4/element.py</File> <File>bS4/testing.py</File> <File>bS4/builder/__init__.py</File> <File>bS4/builder/_html5lib.py</File> <File>bS4/builder/_htmlparser.py</File> <File>bS4/builder/_lxml.py</File> </Package> </Plugin> Can any one advise on how to resolve this? Thank you in advance. Giovanni

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...