Jump to content

GioPet

Member
  • Content Count

    87
  • Joined

  • Last visited

Posts posted by GioPet


  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 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?


  5. 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:

    1. Create List (or Dynarray if in VS) of Handles to Groups in the file
    2. change the Class of each Group through a for loop that takes each item in the list
    3. If the Layer of the Group is different from the Active Layer, the target layer is activated
    4. 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..

     

     


  6. 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.


  7. 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:

    1. Activate the Group's layer
    2. Activate the desired class
    3. 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..

     

     


  8. 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!


  9. 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:

    697561942_ScreenShot2018-10-25at10_09_52.thumb.png.df0be664b5628a8c17e73ce3b99e8521.png

     

    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


  10. 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>

  11. 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.

     

    PluginFolder.thumb.png.632af6b8d76ef1bd72283f8027651151.png

     

     

    thank you

    Giovanni

     


  12. 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.

     

    ScriptOptions.thumb.png.3ff7fcd50d33d9815d7a8120164e5b04.png

     

    <?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


  13. 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.

    ScriptOptions.thumb.png.2b288b169cdbc4d04e5335c296ec9b5e.png

     

    <?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

     

     


  14. I am working on a simple Dialog with a set of Radio Buttons - depending on the selection, the script will perform different sub-procedures.

    I can't find a VS command to get the selected Radio Button.

     

    Any suggestion?

    thanks in advance!

     

    Giovanni


  15. Hi all,

    in order to help the organisation of classes, I have developed a plugin that keeps your drawing structure organised when you paste objects from other drawings.

    If you merge incoming classes with the existing ones, the plugin remembers your associations so that you won't have to clean up your file ever again when you import objects from external consultants or other projects.

    This works well if you have started using AutoClassing at some point later on, and your drawings have a mix of custom and auto classes.

    You'll find a detailed explanation of how you can manage your classes with this tool here: [video:youtube]

    To download, visit https://www.smartpaste.co.uk/

    I hope this helps!

    all the best

    Giovanni


  16. Hi Tui,

    thanks for the reply and the feedback!

    Most functions are available in the Free version of SmartPaste, which can is still a great addition to a simple workflow.

    I'll be soon posting some videos on how SmartPaste can automatically merge classes to match your structure when importing DWG/DXF files from Autocad.

    all the best

    Gio


  17. Hello everyone!

    I am excited to announce the recent release of SmartPaste 3.2 which features several new functions.

    SmartPaste is a plug-in tool that prevents the automatic creation of classes every time objects are pasted from a drawing to another, while giving you great control over your class structure in a very easy step.

    On this page: https://www.smartpaste.co.uk/sample-page/new-features-explained/

    you will find a detailed explanation of how this plugin will maintain your drawings organised at all times while you paste content from other drawings and you won't ever need re-structure drawings from external consultants.

    Depending on your needs check out SmartPaste Free, SmartPaste or SmartPaste PRO.

    The following Vectorworks languages are supported: Chinese, Dutch, English, French, German, Italian, Japanese, Norwegian, Portuguese, Spanish.

    You may also take a look at some free tools for your workflow here:

    https://www.smartpaste.co.uk/intuitive-tools/

    Looking forward to receiving your feedback and comments

    all the best

    Giovanni


  18. Yes, I am mixing the two languages and it's working very well if don't encrypt anything, but i understand it's not ideal.

    My intention is to re-write my entire code in Python in near future, but this will take me a while as the algorithm is quite elaborate (and I am still working on my Python skills)

    So, before I jump entirely in Python, I am mixing the two languages for an important step-release of my plug-in that requires Python functions, while I leave most of the code in VS.


  19. Hi Dieter,

    If I understand correctly, I can leave the $INCLUDE .px files in my main VS script and move all my python code in one single .py file (this is then called by PythonExecute by the main VS script).

    Then I write the xml to package the vsm file and the py, what about the .px that are called with $include? should they also be added in the xml?

    Can I then encrypt the .vsm file using the cmd+opt+shift+CAPS method on from within Plug-in Manager?

    Many thanks

    G


  20. Hi Dieter,

    yes, I have tried vs.Chr(38) but it behaves in the same way:

    The following displays correctly:

    amp = vs.Chr(38)
    vs.AlrtDialog(vs.Concat('ampersand = ', amp))

    but when i use concatenation (either vs.Concat or python native +) AlrtDialog doesn't display the ampersand.

    Bu then I used the concatenated string to make a http call I realised that all my ampersand were there as expected...


  21. Hi all.

    I have always used the method mentioned by matt71:

    http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=169223

    this has always worked well for VS scripts but since I have started implementing python in some of my VS, I encounter the same problems discussed in this thread.

    I have followed Vladislav steps using the xml file, however when I use the command 'Encrypt Script' I get an .xxt file.

    Changing the extension in the encryption dialog does not work, and the xxt file is not read as a plug-in by Plug-in Manager.

    ..How do I get my script to be encrypted as a vsm/vso/vst??

    this is pretty crucial problem,

    thanks in advance for any help

    G

 

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...