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


  • Announcements
    • Announcements
    • News You Need
    • Job Board
  • Feedback
    • Roadmap
    • Wishlist - Feature and Content Requests
    • Known Issues
    • Wishes Granted / Issues Resolved
  • General
    • Troubleshooting
    • General Discussion
    • Architecture
    • Site Design
    • Entertainment
    • Vision and Previsualization
    • Braceworks
    • ConnectCAD
    • Rendering
    • Workflows
    • Buying and Selling Vectorworks Licenses
    • Hardware
  • 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


  • Community Calendar


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


  • 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


Last Updated

  • Start


Filter by number of...


  • Start



About Me






Found 49 results

  1. vs.GetLBHeaderTextWidth(className, allowForSortIcon) The function above is crashing my VW 2021. Anyone else can confirm before I try a reinstall/bug submission? It gets pixel width for specified string (param:className for some reason??) for use with Dialog ListBrowsers.. Cheers, Tui
  2. An script to find the object type number and name of the selected item, works also when placed in right mouse button menu. _hObject=vs.LSActLayer()#get handle of last selected object _tObject=vs.GetTypeN(_hObject)#get typeindex #_tObject=_hObject.type is also possible _list=["1","Line","Rectangle","Oval","Polygon","Arc","7","Freehand","3D Locus","Text","Group","12","Rounded rectangle","Bitmap Image","Symbol in document","Symbol definition","2D Locus","Worksheet","19","20","Polyline","PICT Image","23","Extrude","3D Polygon","26","27","28","Layer Link","30","Layer","32","33","Sweep ","35","36","37","Multiple extrude","39","Mesh","Mesh vertex","42","43","44","45","46","Record Definition (Format)","Record","Document script (1)","50","Script palette (1)","52","53","54","55","Worksheet container","57","58","59","60","61","62","Dimension","64","65","Hatch definition (1)","67","Wall","69","70","Column, Floor, Roof Face","72","73","74","75","76","77","78","79","80","Light","Roof edge","Roof object","CSG Solid (Addition,Subtraction)","85","Plug-in object","Roof element","88","Round walls","90","91","Symbol folder","Texture","Class definition (1)","Solid (Cone, Sphere, ...)","96","Texture Definition(Material)","98","99","100","101","102","103","104","105","106","107","108","109","110","NURBS Curve","112","NURBS Surface","114","115","116","117","118","Image Fill Definition (1)","Gradient Fill Definition (1)","Fill Space (1)","ViewPort"] vs.AlrtDialog('type no. :',_tObject,'\ntype name :',_list[_tObject-1]) # show type index and type name of selected object in an dialog
  3. I'm using vectorscript/python to make an list of all objects with an certain record and using information from this record. to eliminate human errors I'm starting the script with making the record so I'm certain all names and fields are correctly named. The thing that i can not get working at the moment is making an field in the record with an option module. so an field where you can not type but you have to choose between predefined options. does someone know if this is possible to create? when you make an record yourself in VW this is possible so why not with scripting
  4. I know this has been discussed in several threads before, but after extensive reading and experimenting I'm still clearly missing something. I'm trying to get the handle for a user selected object within an event enabled Plug in Tool. e.g User clicks button in OIP -> Highlight mode is turned on and user clicks on desired object -> Handle is returned and code continues onwards. I've created the event enabled object, and added the button to the OIP fine, and used TrackObjectN() to allow highlighting of only relevant objects. The issue I'm running into is actually getting the handle of the object. I understand that TrackObjectN is only highlighting, and not a selection mode, but from my reading of the wiki for TrackObjectN: def vs.TrackObjectN(traverseType, callback): return (outObj, p) It should return the handle and Co Ords whenever the user mouses over or clicks an object that relates to the criteria. e.g if the last action is a click on the desired object it should return that handle, or atleast it's co ordinates from which I could then use PickObject to get the handle. In reality when I try: outObj , p = vs.TrackObjectN(0, trackObjCallback) It throws a TypeError 'NoneType' object is not iterable. Given that when I try: vs.TrackObjectN(0,trackObjCallback) It functions as expected, but without returning any handle or co ordinates i'm guessing either i'm using this wrong or it doesn't actually return such information. I'm wondering if I need to try using vstGetEventInfo to look for a mouse button click and then capture the mouse's current Co Ordinates, however after searching "MiniCadHookIntf.h" I couldn't obviously see any obvious constant for a mouse click. TL/DR I'm trying to capture a handle for a user selected object, within a event enabled object and have clearly missed a step somewhere! Any help or nudges in the right direction would be greatly appreciated! Relevant parts of current code pasted below: import vs def makeOIP(): link_pos_button_id = 1234 # User Button Id theEvent, theEventData = vs.vsoGetEventInfo() # Gets Object Event info if theEvent == tb.Constants.kObjOnInitXProperties: # If the event is the initialisation of the object ok = vs.SetObjPropVS(tb.Constants.kObjXPropPreference, True) # Allows for creation of custom OIP?????? ok = vs.SetObjPropVS(tb.Constants.kObjXPropHasUIOverride, True) # Custom OIP Overrides standard UI vs.vsoInsertAllParams() # Inserts all Parameters into OIP displayString = "Link to HP" # text for button result = vs.vsoAppendWidget(tb.Constants.kWidgetButton,link_pos_button_id,displayString,doesNothing()) # Add Button to OIP if theEvent == tb.Constants.kObjOnObjectUIButtonHit: # If the event is a button being pressed if theEventData == link_pos_button_id: link_to_hp() # Function to run to allow user to select object. if theEvent == tb.Constants.kResetEventID: # If Object is reset # Code to run on object reset def doesNothing(): pass def trackObjCallback(h,x,y): HPHandle = vs.PickObject((x,y)) if vs.GetTypeN(h) == 86: return True def link_to_hp(): vs.TrackObjectN(0, trackObjCallback) outAction, outMessage1, outMessage2 = vs.vstGetEventInfo() #vs.Message(str(outObj)) makeOIP()
  5. I'm writing an script that will take each symbol(_i in list of symbols) from the resource folder makes an render and places it in an folder. for _i in _lSymbols: _Renderlayer=vs.Layer('Render') _hRenderlayer=vs.ActLayer() vs.Symbol(_i,0,0,0) vs.DoMenuTextByName('Standard Views',8) vs.DoMenuTextByName('Fit To Objects', 0) vs.SetLayerRenderMode(_hRenderlayer, 6, True, True) vs.DoMenuTextByName('Copy',0) vs.DeleteObjs() vs.DoMenuTextByName('Paste As Picture',0) _hImage=vs.LNewObj() _iRenderFolder=_RenderFolder+ '\\' +_i+'.png' vs.ExportImageFile(_hImage,_iRenderFolder) vs.DeleteObjs() One problem i encountered is that when i set the render mode as "Final Quality Renderworks" (14) or "openGL" (11) it will produce an white square with "paste as picture". so whit this script I'm limited to using modes as "FinalHiddenLine"(6) Also my "vs.ExportImageFile" is not working at the moment. Can Anyone give some tip ore advise on this script or how the get an similar result using other functions. I also looked into using vs.DoMenuTextByName('Export Image File') but this wil give an dialog for the user and I'm trying to limit/eliminate all user interaction. See also my other topic on an small part of this script
  6. I'm writing an Python script with this part in it: vs.DoMenuTextByName('Standard Views',8) vs.DoMenuTextByName('Fit To Objects', 0) vs.SetLayerRenderMode(_hRenderlayer, 6, True, True) Now i have the problem that the script gives the order to set the view and zoom and VectorWorks will do this , but when the script is ordering to set the rendermode VW is still busy setting the zoom and view and will skip this step. If i run this script again without changing my zoom and view it will set the render mode correct because then VW can skip zoom and view and is ready when it gets the order to change the rendermode. I Think the issue is probably that VW is visually showing the zoom an view change and that takes time. To set the rendermode first is not working because it will change back to wireframe when the zoom/view is changed. I also tried the function vs.Wait() but this is not making any difference except the script takes longer to run. Has someone an idea to overcome this?
  7. Hi All Apologies if I've missed something glaringly obvious (I've searched the forums and can't seem to find an answer) i'm wanting to create a dialog where the user can still interact with the OIP and the rest of VW whilst said dialog is open and running. Effectively I want a dialog window that is open and on top, but still allows users to interact with the rest of VW. I'm wondering if I might be able to accomplish this with SetLayoutOption() however for the life of me, I can't find a list of options and values I can pass to this command. Is there a convenient list of said options somewhere? Or can anyone suggest another way to accomplish this?
  8. 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
  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. Hi all, I have some plugin objects that I would like to use predefined symbols instead of drawing their geometry for each instance, but I'm having a lot of trouble figuring out how to import a symbol from a user library. It looks like the functions under "Document List Handling" might hold the key, but I can't make any sense out of them. Is what I'm trying to do possible? What would a basic script for this look like? Thanks!
  11. Wondering if anyone can advise on this - I'm having some trouble with control point precision that is leading to erroneous behavior in a plugin object. I detected this issue in part through the debugger. Basically, when I drag a control point, it seems that the values I get when I access its coordinates from inside the scripting environment are truncated to only 6 decimal places. This introduces error into calculations based on that value. I have tested further by creating an object to use as a snapping location, and setting the position of this object to coordinates that require more than 6 decimal places to represent. If I increase the decimal place precision in the document unit preferences, I can see all of these decimal places in the OIP for the reference object. If I drag a control point in my plugin object to snap to this reference object, and then, by setting a breakpoint, inspect the value I get inside my script by accessing the control point (with, for example, vs.PControlPoint01Y), I see the value is still truncated, regardless of the document unit / precision settings. At only 6 decimal places, this can introduce pretty significant error. Is there some obvious thing I am missing to correct this behavior? I would expect that when I snap a control point to a location, the control point would be assigned a value as accurate as possible, or at least as accurate as the document settings indicate. Not sure if this is specific to Python scripting or not.
  12. Hi, I am currently looking into creating a script to import a folder of images and create image probs from them. I found a completely undocumented function vs.CreateImageProp(...). But as it is takes in a texture, i got lost trying to create the corresponding texture object from the images loaded. Anyone having some scripts which could help me on my path? Thanks in advance. Cheers Jonas
  13. Hi all, The wiki only lists two constants for vs.AddAssociation, 4 and 5. I figure there must be more, but I've scoured the SDK and found nothing. Anybody know if there are other associations, what they are or at least which SDK file I should be looking in? Thanks!
  14. I have two worksheet questions. 1.) I'd like to link rows of a worksheet to instances of a PIO to store some parameters and format settings. Right now I'm creating a UUID, storing that in a hidden parameter and in the last column of the worksheet, and then I match the UUIDs to push/pull data. This is not only a bit ugly, but a user can easily change the cell, breaking the link. On the other hand, if I store the initial row number in a hidden parameter, the user could rearrange the rows and break the link that way. Is there an elegant way to link rows with Python/Vectorscript? Or maybe some methods I've overlooked that might help? 2.) The PIOs are event-enabled, so when a parameter is updated, it automatically updates the worksheet. I'd like this to work the other way around. In the SDK I found this property: kObjXPropGetWorksheetEvents = 57. To me that looks like an event-enabled PIO is aware of changes in worksheets, but I haven't been able to find any other information on what event IDs to use, or how to point a PIO at a specific worksheet. Is is possible for edits in a worksheet to trigger a parametric recalc in a specific PIO? Thanks, All!
  15. I'm trying to manage the shared recourse manager at my company. In the library and on the internet I can hardly find nodes to interact with the recourse manager instead of the design layer. For example whit "objs by crit" I can only select symbols that are place in the design layer. Am i missing something or does someone has nodes i can use. What I'm planning to do: with the programme we use for managing our stock we can get an excel file with art. numbers, description, amounts and dimensions. when we make an new article/symbol and we place it in the resource manager, I want to make an script that checks the name of the symbol (which we will give manually by using the article number) When it recognises the symbol name(Art. number) it wil changes its name in art. number+description. also the extra information will be put in an record attached to the symbol. Problems(challenges) I'm facing so far: obj name and symbol name are different things. missing a node to get symbol name. attaching record is only attaching it to the symbol as object and not to the symbol itself, so when i put information in the record it doesn't change copies of this symbol. A node of some kind to get an list of symbols in the resource manager. No node of some kind to change a symbol name. I already started rewrite code's of some nodes to make them do what i want, but still learning and not much experience with python.
  16. As I've read, it's possible to use an external text editor instead of the built-in one. I'd like to be able to keep a .py file open, save it, and have it automatically update in Vectorworks, and I'd think there would be a way to select a file to be referenced, but I can't figure out how to do this; I also haven't found anything useful on the developer page. When I navigate to the plugins manager there are .vso and .vst files with the names of plugins I've created, but if I try to open them in Sublime it's just a string of integers. How can I integrate a text editor into my workflow?
  17. I'm trying to explore scripted Python plugins, but I'm having trouble finding any basic information on how scripts function within a plugin and interact with specified parameters. For example, I've created a tool plugin and put in what I thought was the most basic script: vs.Message('Test Tool') When I click on the tool I get an error message: Identifier Not Declared. What does this mean? I tried declaring a function and then running the function, but I get the same error, always on the first line; even /import vs/ will give me this error. Just looking for a place to begin experimenting.
  18. So I am attempting to encrypt some plug ins objects (a mix of .vso and vsm objects) to distribute to others. I've done some searching of this wonderful forum, aswell as reading the Vectorscript Guide section on encrytion. Following the instructions in this thread. I created a XML File named the same as my PIO, My code is directly inside the object so I don't need to include any extra files so my XML file just 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> </Package> </Plugin> I've selected my plug in in the plug in manager, used the Ctrl+Shift+Alt and Double Click method, confirmed twice that I want to encrypt it. All seems to be successful, it won't let me edit the script anymore. However if I go look at the .vso file in a text editor I can still see all the code. Also if I copy the file out of my plug in folder, and then copy it back in, replacing the original, (To try and test installation process for another a new user) I can then edit the scripts again. Am I missing something super obvious? I've seen other people running into similar problems in other threads, but I haven't found any solutions anywhere.
  19. Hello I'm trying to create a worksheet with a database row that looks for a certain record and then displays each field in it's own column. The issue i'm running into is actually making the row into a database row. Below is the code I am using at the moment. My understanding (which I suspect is wrong) is that I need to set the a formula for row 2 column 0. dynCharArray = '=DATABASE(INVIEWPORT & INSYMBOL & (R IN [Loom Note]))' vs.SetWSCellFormulaN(tempHandle,2,0,2,0,dynCharArray); When I run the code I get a popup box saying "Right Bracket Expected", no error messages from the script, just that popup box, and the script will have failed to turn the row into a database row. From my googling I'm struggling to find much documentation for building worksheets with Python Script/ Worksheet Formulas. (I'm sure it's out there I'm probably just not looking in the right places.) Would anyone be able to point me in the direction of some handy info on worksheet formulas, or give me a hint as to what i'm doing wrong here? Running VW 2020 Sp3.1
  20. Hello, i use a script with just the function "vs.CallToolByIndex(-210)" (for Dimension). The tool starts and i can create the dim. After the Dim is createt VW start stocking and than crashing. Is this a bug?
  21. Hi All, So, I'm running into a bit of an issue with Spotlight's Data Cable Worksheet. Apparently, the option to include the 'End Label Text' in the worksheet generation doesn't exist. I figured it would be fairly trivial to write a python script to crawl all Data Cable Objects in the drawing and read the 'Start Label Text' & 'End Label Text' fields and write them into the 'User Field 1' & 'User Field 2' fields. The following code accomplishes this for a lighting device: import vs def xyz(current_light): xypoint = vs.GetSymLoc(current_light) zpoint = vs.Get3DCntr(current_light) vs.SetRField(current_light,'Lighting Device','User Field 7',str('{:.3f}'.format(xypoint[0]/12)) + "'") vs.SetRField(current_light,'Lighting Device','User Field 8',str('{:.3f}'.format(xypoint[1]/12)) + "'") vs.SetRField(current_light,'Lighting Device','User Field 9',str('{:.3f}'.format(zpoint[1]/12)) + "'"); vs.ForEachObject(xyz,"INSYMBOL & (PON='Lighting Device')"); I adapted this code as follows to try to get it to work for a Data Cable: import vs def label2user(current_cable): start = vs.GetRField(current_cable,'Data Cable VW','Start Label Text') end = vs.GetRField(current_cable,'Data Cable VW','End Label Text') vs.SetRField(current_cable,'Data Cable VW','Rack ID',"barf") vs.SetRField(current_cable,'Data Cable VW','Box ID',str(end)) vs.ForEachObject(label2user,"INSYMBOL & INVIEWPORT & (PON='Data Cable VW')"); Unfortunately, the second chunk of code doesn't work. I have verified by inserting a vs.AlrtDialog() into the code that it is properly reading the values from each Data Cable Object. Unfortunately, the vs.SetRField() commands seems to fail. I have also tried to write to other fields but the same results keep occurring. Anyone have any thoughts? Cheers, -gonda
  22. 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?
  23. 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..
  24. Heyo, I tryed to use parameter and strings wich can be added in the Plugin Manager. But i dont get how to use them in the Python Scripts... The Vectorworks Helpsheet dindt really help to make this clear. Can someone take my dumbness away and tell my how this System works?😅
  25. Here's what I'm trying to do: User selects an object User then selects the PIO tool and inserts the PIO PIO uses info from the selected object as a parameter value. Currently: I get the handle to the user selected object using LSActLayer or FSActLayer. Use GetRField to extract the information from the object. Run GetCustomObjectInfo to get the PIO handle Write the information to the PIO using SetRField The problem I'm having is that it appears that a PIO resets(vsoGetEventInfo #3) itself 3 times before the creation is finished. On the first reset event the handle still points at the user selected object, on the second reset event the handle is empty, on the third reset the handle points to the new PIO. Short of writing the information to a file how do I get the information from a user selected object into a PIO on creation?


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