Jump to content

tbexon

Member
  • Content Count

    20
  • Joined

  • Last visited

Community Reputation

2 Neutral

About tbexon

  • Rank
    Greenhorn

Personal Information

  • Location
    United Kingdom

Recent Profile Visitors

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

  1. @K.Lalkovski Apologies for the delay getting back to you, I've been away from my PC for a while! So I followed your instructions, and found that the new pip3 solved the issue, VerifyorGetLib appears to work once again. To confirm something else hadn't changed in the meantime I swapped back to the old version of pip3 and received the same expected errors as before. Is that a different version of pip from the once distributed within the VW installer? I know I tried completely uninstalling and reinstalling VW early on in my fault finding process!
  2. @K.Lalkovski I'm on SP4 Build 550627 - Which I notice is a different build to yourself, I THINK i'm on the most up to date version, as I tried reinstalling VW from a fresh download as part of my fault finding process. output from script: === RESTART: D:\Program Files\Vectorworks 2020\Python35\get encoding info.py === sys.stdin.encoding = utf-8 locale.getpreferredencoding = cp1252 locale.getpreferredencoding = cp1252 sys.getdefaultencoding = utf-8 sys.getfilesystemencoding = utf-8
  3. As a work around can anyone think of any reason why adding into the install.py script some code to manually copy what would normally be the final contents of external python packages into the user folder?
  4. If my understanding of what I read here is correct It should run without any special characters, however I tried "pip install" as well which definitely doesn't require any special characters to run.
  5. I really wished I seen this thread yesterday... Something has definitely broken within VerifyOrGetLib / Pip. I was just about to release a new plug in package, and was doing some final testing, and discovered that my external libraries installation script has stopped working for some reason. I've posted my install code below, (very similiar to ops). I should note i'm doing this on windows, haven't tested on Mac. import shutil import os import vs import Marionette import platform import sys def installOpenSSL(): Usr = vs.GetFolderPath(-12) (major, minor, maintenance, platform, buildNum) = vs.GetVersionEx() if platform == 1: Path = Usr + 'temp/tempImg.png' else: Path = Usr + 'temp\\tempImg.png' vs.AlrtDialog(str(sys.version)) module = 'https://files.pythonhosted.org/packages/9e/de/f8342b68fa9e981d348039954657bdf681b2ab93de27443be51865ffa310/pyOpenSSL-19.1.0-py2.py3-none-any.whl' if Marionette.VerifyOrGetLib('OpenSSL', module): pass else: vs.AlrtDialog('Error Installing Module') installOpenSSL() I tried skipping the Marionette call, in case the issue lay somewhere within there and invoked the subprocess.call directly, which returns Error code 1. To gain some slightly better feedback as to what was going on I swapped to subprocess.Popen. I tried a combination of different pip commands, the below code should list all installed packages. import vs from collections import OrderedDict import operator import copy import os, sys, subprocess, urllib.request, importlib, logging import itertools appfolder = vs.GetFolderPath(1) appuserfldr = vs.GetFolderPath(12) piploc = 'Python35\Scripts\pip3.exe' pathpip = 'Python35\Scripts' cdpath = os.path.join(appfolder, pathpip) cmdpip = os.path.join(appfolder, piploc) ret_code = subprocess.Popen([cmdpip, 'pip list' ], stdout = subprocess.PIPE, stderr=subprocess.STDOUT ) output, err = ret_code.communicate() vs.AlrtDialog(str(output)) vs.AlrtDialog(str(err)) For all commands the error I get is: File "D:\Program Files\Vectorworks 2020\Python35\Scripts\pip3.exe", line 1 SyntaxError: Non-UTF-8 code starting with '\x90' in file D:\Program Files\Vectorworks 2020\Python35\Scripts\pip3.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details Now i'll be honest just getting this far has stretched my coding knowledge, and I don't have the knowledge to suggest any fixes or solutions from this point. I also accept there's a high chance my use of subprocess commands may be the reason i'm getting this particular error, however there's no denying somethings broke since SP4
  6. You need to use the import command. So your .vsm file literally looks like: import external_python_script And then you make sure that the external python script's code does some thing on initialization. To encrypt the plugin that's in the same directory, I just encrypt with a "blank" .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> </Package> </Plugin> As long as there both in the same directory should work fine. Note if you're .vsm + Script are in a subfolder within plugin folder you may need to modify the import command accordingly.
  7. Thanks! GetBBox worked perfectly! I had to get the bounding box of the symbol definition though to ensure that the rotation of the placed symbols didn't affect the calc. import vs symdef = vs.GetSymName(vs.FSActLayer()) # Gets Symbol name for selected object symHandle = vs.GetObject(symdef) # Returns the SymDef Handle (p1X, p1Y), (p2X, p2Y) = vs.GetBBox(symHandle) # Gets Bounding Box Co ordinates for Selected object tota_length = p1X -p2X # Difference between left and right X Values
  8. Thank for the response Patrick, in terms of specific commands, should I be looking at BotBoundN, TopBoungN, LeftBoundN and RightBoundN? I've had a bit of a play with them, but the results i get don't really line up with what I expect to get. I'm looking at writing a (hopefully) all encompassing solution e.g my script can deal with all possible kinds of objects I may find inside. I've worked out how to iterate through the HP position, using GetCustomObjectProfileGroup, and from there I identify what kind of object i'm dealing with. If it's a truss object with record, that's easy to deal with. The one i'm struggling with atm is symbols that are NOT truss objects and don't have any record attached to them. As Patrick suggested above i'm having a play with trying to get bounding boxes working, however failing that have you any particular commands you'd point me towards to easily get the overall length of a symbol?
  9. I'm currently working on a couple of plug ins that need to interact with Spotlight Hanging Positions. The first thing i'm trying to do is get the total length of a hanging position. Thanks to some excellent topics and replies from @Sam Jones and @JBenghiat I've got my head around accessing the objects within the hanging position group, and the different kinds of objects I may expect to find within, and iterating through the objects to get the total length. My question is: For HP's containing Truss PIOs is it better practice to use the TrussItem parametric record or the Truss Record for getting the length? From what I can gather the TrussItem Length field is affected by the units of the active documents units, whereas Truss Record appears to always be in metric mm. I think using the Truss Record probably makes more sense as then I have a consistent set of units and don't need to worry about logic to work out the units of measurement. I just wanted to try and get some confirmation if my thinking was in fact true or if i've missed something. Secondly for HP made up of individual symbols (so no truss record) is there a way to get either the symbols total length or the even more directly the HPs total length? For bonus points are there any good resources floating around that deal with the inner mechanics of Spotlight? Pretty much everything I've managed to do with spotlight so far has had to be learnt through trail and error! Thank you in advance
  10. Interesting I shall give this a go! I was under the impression that the Ctrl+Shift+Alt method was basically just calling the vs.EncryptPlugin() function. I shall try encrypting via this method and report back!
  11. Thanks David, So i've been doing some more reading around this. As per you're suggestions i've now structured by plug ins so that the plug in script is simply: import script_name Then I have a separate .py file with all my script in. This works absolutely fine, until I come to encryption. To Encrypt I take the (in this case) .vsm file, but it into my batch encryption folder, I take the .pyc file from __Pycache__ and add that into the same directory. I have a XML File named the same as the .vsm file. The XML looks like this: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!-- This file defines how the corresponding script plug-in should be packaged--><Plugin> <Package> <file>DMX_Parameters_Per_Position.pyc</file> </Package> </Plugin> I then run a script that runs the vs.EncryptPlugin(full_path) command on the specific file. This doesn't return any errors, all seems happy. However when I copy the .vsm back into VW Plug in folder, and remove the orginal my_script.py. I get an error saying that the script can't find my_script module to import. Then if I restore the my_script.py everything works again. My understanding of .pyc files was that they are a compiled version of the .py script, and most of the responses I have read online suggest that a script should be able to import a module from a .pyc just fine. I've tried variations of having the .pyc in the same directory as the plug in command, aswell as within it's original __pycache__ folder. I'm unsure at this stage whether I am doing something wrong with the XML file and VW isn't looking in the right place for the file, or if i've misunderstood something fundamental about .pyc and .py files?
  12. Thanks Joshua, that's really helpful! Guess thats my weekend then! Doing some research into obfuscation...
  13. I just tried the exact same encryption script with a Vectorscript plug in, worked absolutely fine, the file is completely encrypted, so this seems to be a python specific issue?
  14. Ah Thanks I had originally looked at using vs.EncryptPlugin, but I don't believe it's included in 2020 Library as standard as I kept getting errors saying the command wasn't valid. Since placing the Batch Encryption Library in my plug in folders, those commands do now work. I'm using this code to iterate through everything in the required folder: import vs from os import listdir folderpath = "D:\\Users\\tbexo\\Batch Encrypt Plug ins\\" filelist = listdir(folderpath) for eachitem in filelist: full_path = folderpath+eachitem vs.EncryptPlugin(full_path) vs.AlrtDialog("All Plug ins Encrypted") Even though i am only encrypting one .vsm with no dependencies (i've also tried .vso's just to be safe) I get an error saying that no "Plug Name".xml file can be found. So I create a XML file, same as I detailed above, and the operation does seem to be successful (Or atleast go through with no errors). HOWEVER my plug ins still aren't being encrypted properly. When I copy the encrypted plug-in back into my VW Plug-in folder, VW Plug in Manager does recognize that it's an encrypted plug in, however I can still see the all the code when I edit it them with a text editor. I'm not sure what i'm doing wrong at this point?
  15. Is this the batch encryption plug-in from the SDK? I must admit I haven't really delved into SDK yet. I've downloaded it, located the batch encryption plug in, a .vlb file?? From looking at this wiki page the way I read it is a .vlb is a SDK plug in, and I should be able just put it in my plug in folder? I attempted this, and couldn't see the plugin from the plug in manager. I'm guessing i'm missing (several) steps?

 

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