Jump to content

Search the Community

Showing results for tags 'python'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Announcements
    • Announcements
    • News You Need
    • Job Board
  • Feedback
    • Wishlist - Feature and Content Requests
    • Known Issues
    • Wishes Granted / Issues Resolved
  • General
    • Troubleshooting
    • General Discussion
    • Architecture
    • Site Design
    • Entertainment
    • Vision and Previsualization
    • Braceworks
    • Rendering
    • Workflows
    • Buying and Selling Vectorworks Licenses
  • Customization
    • Marionette
    • Vectorscript
    • Python Scripting
    • SDK
    • 3rd Party Services, Products and Events
  • Solids Modeling and 3D Printing
    • Subdivision
    • Solids Modeling
    • 3D Printing
  • Vectorworks in Action
  • Archive
    • Resource Sharing
    • Machine Design

Categories

  • Knowledgebase
    • Tech Bulletins
    • Troubleshooting
    • Workflows
    • How To
    • FAQs

Categories

  • Marionette - Objects
  • Marionette - Networks
  • Marionette - Nodes
  • Marionette - Menu Commands

Product Groups

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Occupation


Homepage


Hobbies


Location


Skype

Found 25 results

  1. Hello people, I just edit because I found this way. import vs import os Vendor = 'ACME' Price = 123.45 Tax = 1.07 fileName = 'Classes.txt' def Example(): vs.GetFile(fileName) if not vs.DidCancel(): vs.Rewrite(Vendor, 0) #vs.WriteBin(Vendor) #vs.WriteMac(Vendor) #vs.WriteLnMAC(Vendor) #vs.Write(Vendor) vs.Close(fileName) Example() But, the next attributes get this message: "AttributeError: module 'vs' has no attribute 'WriteBin'. " -vs.Write -vs.WriteLnMac -vs.WriteBin -vs.WriteMac With write I don't get error, but also no result. -vs.Rewrite
  2. 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
  3. 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
  4. Hello, I am kind of new on Python but not on Vectorworks. I have a custom symbol that contains 2 text labels: one contains a number like "2,43", the other is always the same text not attached to the database. I need to get read that "2,43" and later do the contrary: be able to write into the field in the symbol another number. some ideas?
  5. There are many ways to customize Vectorworks to better fit your needs. You can script in VectorScript or in PythonScript. You can create a Marionette network. You can create a custom worksheet. What you have not been able to do until now is find an in-person place to interact with others also interested in customizing VW. Michael Klaers and Pat Stanford (all around Good Dudes™ and frequent posters on the forum) would like to change that. But we need to judge if there is sufficient interest to make it worth our time to do the organizing. We have posted a short survey. 10 questions. You can answer them all in less than 2 minutes. Give us 10 minutes and you can have massive input into the event. We are truly interested in your responses, regardless of if you like the idea or not, we would like to get your feedback so we can see a broad cross section of users. The survey is posted at https://www.supersimplesurvey.com/survey/20404/conference-interest No personal information is required. We won't spam you. We just have this idea and want to see if others are with us. Thanks in advance. We hope the interest exists and we will see you at the first annual Customization Conference.
  6. ktritz

    Anaconda Python Qt

    After I installed Vectorworks 2018, my Anaconda python installation could no longer use Qt, so python apps like spyder and matplotlib didn't work. I found out that, for some odd reason, Vectorworks 2018 puts the Qt dll files (QtCore.dll, etc...) in the Windows/System32 directory, which overrides the ability for python to use the PATH environment variable to find and use its own installed Qt DLLs. I moved the Qt DLLs from the Windows/System32 director into the Vectorworks2018 folder, and that seemed to fix the problem. Both Vectorworks and my Anaconda python distribution work properly now. I had to do this again after the most recent Vectorworks Service pack update. I would strongly urge Vectorworks to not use the Windows/System32 directory for DLLs that can interfere with the operation of other installed programs. Just thought I would post this here in case anyone else runs into this issue.
  7. As promised, I wanted to highlight some new things you'll see for Marionette in Vectorworks 2017! I've made a little video with snippets of the improved features, and although I haven't gotten to it yet, I'll go into greater depth of the more complicated features and how you could incorporate them into your workflow! (I know, I'm a slacker, but I still haven't gotten over hearing my own voice... so recording more videos has been slightly traumatic.) If you have any questions, big or small, I'm available almost all of the time (while I'm not eating or sleeping) to obsess over Marionette with you!
  8. Been looking for some definitive info on vectorworks.net and a bit of googling too. Thought I'd just ask instead. Are custom worksheet functions that you call using the RUNSCRIPT() worksheet function excluded from Fundamentals??? Conrad
  9. Greetings and Happy New Year to you all, Has anyone figured out how to duplicate an object (locus,symbol) along a 2D path, be it a polyline, polygon? Developing a plugin to take a symbol object and have it duplicate along the Plugins 2D path (this being a 2D poly path plugin object type). Have tried the : def vs.GetPointAndParameterOnNurbsCurveAtGivenLength(inNurbCurve, inPercentOfLength): return (BOOLEAN, p, outParam, outIndex) by converting the 2D path to a nurbs object, running the calc, then copying the /out/ data to the 2D path poly. However just realised the convert to Nurbs command takes into account the orientation of the view. This makes it not feasible for a path-pio object. Any ideas? Cheers, Tui
  10. Greetings Pythonistas, Getting "SyntaxError EOL while scanning literal" script error, when there is an apostrophe in one of the parameter fields of my custom plugin object. I am trying to figure out how to catch/handle this exception before it gets processed. Any thoughts @Dieter @ DWorks, @JBenghiat@Hippocode.. trying to think of others.. @Miguel Barrera@Pat Stanford@Matt Panzer..
  11. alberto72

    Checking Type of Variable

    Why import vs number = "123" vs.Message("Type=", type (number) ) returns : "Types =" instead of "Types =int" ? Thanks
  12. Hi, wondering if anyone has encountered this or knows of a solution: When I enable custom object info palette for a plugin object with vs.SetObjPropVS( vs.kObjXPropHasUIOverride, True ) #8 I find that trying to change the value of radio buttons in the object info palette crashes vectorworks. I have inserted all of the widgets with vs.vsoInsertAllParams() I'm not trying to do anything crazy; I am really just trying to get some separators onto the OIP. I am handling Event 41 as guided by the wiki: ... elif theEvent == vs.kObjOnWidgetPrep: #41 UpdateParametersState() ... def UpdateParametersState(): vs.vsoSetEventResult( vs.kObjectEventHandled ) #-8 Changing the value of other parameters in the OIP, including numeric fields and checkboxes, works fine. Most importantly, I see the same behavior when I try the example plugin provided at http://developer.vectorworks.net/index.php/Python_Sample_Point_Object_(complex) If I click the radio button for Male / Female in this PIO's info palette, vectorworks crashes. This leads me to think there is more going on than bad code in my own object. I am running VW2017 SP4 on Mac OS X El Capitan
  13. Hi all, I am creating a Linear plug-in object, and trying to catch and respond to the event where a user changes the LineLength by moving one of the two built in control points of the object. However, I cannot seem to figure out what event / state change this qualifies as. The vso states I know of are: vs.kCreatedReset = 0 vs.kMovedReset = 1 vs.kRotatedReset = 2 vs.kParameterChangedReset = 3 vs.kObjectChangedReset = 4 vs.kLayerChangedReset = 5 vs.kExitFromEditGroup = 6 vs.kObjectNameChanged = 7 Below is an example of some code I have used to try to detect this state change. Alerts appear as expected for move, rotate, attribute change, and parameters changed either in the OIP or by moving an added Conrol Point parameter in the drawing, but when I drag the two points that are actually built in to the PIO, although I do receive 3 for the event, triggering the ResetEventHandler in this case, no alert fires off for any of the checked state changes. It seems that this state change is not one of those listed above. I expected it to be a Param change along with possibly a rotation and position change, depending on which of the two points was dragged. Can anyone advise on what state I need to check for, and how I can capture the new and old value for line length, rotation, and position that could have been adjusted by this action? def execute(): global objname, oh result, objname, oh, rh, wh = vs.GetCustomObjectInfo() theEvent, message = None, None theEvent, message = vs.vsoGetEventInfo() if theEvent == vs.kObjOnInitXProperties: #5 #enable eventing for this plug-in vs.SetPrefInt( vs.kParametricEnableStateEventing, 1 ) #590 result = vs.SetObjPropVS(vs.kObjXPropAcceptStates, True) #18 elif theEvent == vs.kObjOnAddState: #44 message = vs.vsoStateAddCurrent( oh, message ) elif theEvent == vs.kParametricRecalculate: #3 ResetEventHandler() def ResetEventHandler(): global objname, oh if vs.vsoStateGet( oh, vs.kCreatedReset ): vs.AlrtDialog("Object Just Created") if vs.vsoStateGet( oh, vs.kMovedReset ): vs.AlrtDialog("Object Just Moved") if vs.vsoStateGet( oh, vs.kRotatedReset ): vs.AlrtDialog("Object Just Rotated") if vs.vsoStateGet( oh, vs.kParameterChangedReset ): vs.AlrtDialog("Parameter Changed") if vs.vsoStateGet( oh, vs.kObjectChangedReset ): vs.AlrtDialog("Object Changed")
  14. Hey All, So, now that I'm in the process of attempting to use the python that was generated by Dialog Builder, I'm finding a few other issues. I'll summarize below in addition to my already mentioned post regarding semicolons: All instances of the true/false inbuilt constants are listed in all caps (i.e. TRUE, FALSE), which generates an error since the inbuilts in python are "True" and "False". Dialog Builder is trying to pass strings directly to the GetStr function instead of an integer. Since all GetStr does, is index a number to a string I can't think of a good reason not to just pass the hard integer values in this call: dialog = vs.CreateLayout( GetStr('dialog_title'), True, GetStr('ok_button'), GetStr('cancel_button') ) Cheers, -gonda
  15. Gonda

    vs.TextSize Bug/Error

    Hey All, So, I don't know if anyone has done a lot of drawing of text through python, but I think I've either found a bug or am completely misunderstanding how to vs.TextSize works. I realize that text size changes relative to Layer Scale. In my script have defined a scale factor to take this into account. The problem that I seem to be running into, is that when the drawing is set to Millimeters for units, the smallest that I get the vs.TextSize function to draw is 1. When I set the font size to less than 1, the text doesn't draw at all. Now if I just drop a text object into the drawing, I can seemingly set the Font Size down to at least 0.01 Point via the OIP pulldown. I may be wrong, but it appears as if the vs.TextSize function, even though it says it accepts non-integer values, appears as if it is applying a rounding function to the input before passing it to the actual drawing routine within VW. Has anyone encountered this before or am I just overlooking something that is completely obvious? Cheers, -gonda
  16. Hey All, So, I'm working on implementing a Custom Object in python that I want to have Events enabled for. I understand the I need to use vsoGetEventInfo function to get the Event ID and any related info (Control ID, Button ID, etc)...my question is, if there a list somewhere of all of the possible Event ID Integers and descriptions of what each of them are? I've tried looking through the dev documentation and I've found a few scattered here and there in various examples but I have been unable to find a comprehensive list. Does anyone either know where one of these is or has a list that they can post? Cheers, -gonda
  17. webdevsimon

    Selected polygon properties

    def rename(h): vs.AlrtDialog(h) return () vs.ForEachObject(rename, "((L='Layer') & (SEL=TRUE))") Hi, sorry in advance if I'm not using the correct terms. I'm new to Vectorworks and I want to write a script which get the properties of selected objects. At the moment I have a Handle object which does show me the attributes of the selected object. I want to use the data to populate other objects in the same layer.
  18. I created a plugin object using python. The main code was pasted into the script editor via the plugin manager. I compiled the script and the plugin item works as it should. Now I would like to lock the script. I'm on a mac and recently made the jump from Vectorworks 2008 to 2016. In the past when creating a vector script I could lock it by holding down 'command' + 'option' + 'shift' + 'caps lock' (it was important that all external files had the extension .px) Now i'm in 2016 and scripting with Python. I only have 1 other file in addition to "import vs", which is, "import shapes" when i compile my script (shapes.py). It finds this file via the scripts options/environment paths. How do I go about locking or encrypting this plugin object? also, I do have a __init__.py file included in the folder that contains shapes.py
  19. Greetings all, I'm trying to wrap my head around, showing an image in dialogue. I see this function call: def vs.CreateImageControl2(dialogID, controlID, widthInPixels, heightInPixels, imageSpecifier): return None ..but can't get it to work. The issue is with the 'imageSpecifier' parameter. Looking at other posts, https://forum.vectorworks.net/index.php?/topic/41757-2014-script-will-not-run-in-2015/&do=findComment&comment=209508 @klinzey instructed the use of a folder named _some_name.vwr, with your image in there, and use that path for the imageSpecifier. However, what if you want your image structured down the folder channel the same way your plugins are structured. Eg AppData |-- Roaming |---- Nemetscheck |------ Vectorworks |-------- 2016 |---------- Plugins |------------ TuiPlugins |-------------- PluginImages |----------------| rectange.png |-------------- Rectangle.vso full_image_path = "TuiPlugins\PluginImages\rectangle.png" def CreateDialog(): -- vs.CreateResizableLayout(etc,etc..) -- vs.CreatePullDownMenu(etc,etc..) -- vs.CreateEditText(etc,etc..) -- vs.CreateImageControl2(dialog, k_image , 200, 200, "{}".format(full_image_path)) can this be done? Or does the folder have to have the .vwr characters appended to it? And can the location of this *.vwr folder be placed further down? Hope this makes sense
  20. Could you please add python syntax-highlighting for posting code to the forum. Thanks
  21. I've been trying to get data from a worksheet by Python script. Here is the basic code: def FindTable(): hLayer = vs.GetParent( vs.FObject() ) vs.EnableDrawingWorksheetPalette(True, None) while hLayer != None: h = vs.FInLayer( hLayer ) while h != None: # worksheet? if vs.GetTypeN(h) == 56: rows, cols = vs.GetWSRowColumnCount(h) cellnum = vs.GetCellStr(h,1,1) vs.AlrtDialog( vs.Concat('Cell 1 ',cellnum,' Name: ',vs.GetName(h),' visible: ',vs.AreWorksheetGridLinesVisible(h),' rows=', rows, ' cols=', cols) ) h = vs.NextObj( h ) hLayer = vs.NextLayer( hLayer ) return 0 It doesn't work and returns 0 rows and columns. I guess "Worksheet container" type is not good and these APIs don't work but the cycle returns only handle with type 56 even without any 'if' condition. Maybe "Worksheet" type is what I'm looking for? types and IDs But how can I obtain it?
  22. Hi, I need some help with custom plug-ins. I created a custom plug-in with a custom point object. It seems to work fine Now I need to create a command that will be executed from a menu that invokes the tool to place the custom point object in the document. I've been looking around but I don't seem to find how to do it. My questions are How to invoke the tool for the custom point object from the command script How to set up the parameters for the custom tool (Height, Width, etc.) for the new object I'm about to create Thanks in advance.
  23. I would like to be able to export to pdf from a script without having to prompt the user to choose pdf settings and a location or filename for the files. Currently the only way to do it is to call these functions like this: vs.AcquireExportPDFSettingsAndLocation() vs.OpenPDFDocument(inFilenameStr) vs.ExportPDFPages(savedViewNameStr) vs.ClosePDFDocument() Could we we have an alternative to the first function like this: vs.SetExportPDFSettingsAndLocation( location, dpi, blah, blah, etc)
  24. Having trouble getting vectorscript functions that require a vector as parameter to work properly. In the snippet of code below, I think that ang should equal 45°. But the dialog tells me -90° and then I get the error shown in the attached file: pt= [1,1] ang = vs.Vec2Ang(pt) vs.AlrtDialog(ang)
  25. https://forum.vectorworks.net/index.php?/topic/44990-syntaxerror-eol-while-scanning-literal/ Apparently it's a Vectorworks Python API bug. Can we please have this fixed, as after this error occurs you cant get rid of the error until you restart Vectorworks

 

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.

×