Jump to content

Search the Community

Showing results for tags 'python'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

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

Calendars

  • Training Events
  • Coffee Breaks
  • Essentials Seminars
  • Webinars
  • Community Groups

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

  1. 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.
  2. 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.
  3. 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.
  4. 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
  5. 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?
  6. 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
  7. 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?😅
  8. 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?
  9. I just spent three hours trying to track down problems with my Anaconda python installation when I remembered to my chagrin that I had recently updated my Vectorworks 2018. I then remembered that for some reason Vectorworks likes to put the Qt DLL libraries in the Windows\System32 directory which immediately breaks the Anaconda installation. Don't Do This! Vectorworks works perfectly well when the Qt DLLs are placed in its own home directory. I really don't want to forget about this the next time I update Vectorworks and go through the process of reinstalling Anaconda because I mistakenly believe I broke a python library.
  10. Hi, Some years ago I wrote a few tools in Vectorscript based on a number stamp. The idea is simple enough: enter a starting number in a dialog, start clicking, the number increments and is "printed" in the drawing on each mouse click. In the actual implementation there is other stuff going on too, but it's just this part I need help with at the moment. The Vectorscript tools work fine, but now I would like to re-write them in Python, but I can't get it working at all! This is because I am probably too stupid to understand what I need to do, but also it is because of the way GetPt() seems to works in Python. Also I don't get how to use KeyDown() in Python. I am open to any suggestion on how to do this in python in any way it works: Enter a starting number in a dialog Start clicking to add numbers (as text) that increment with each mouse click. It seems like this should be simple enough, but I have been trying to get it to work for a while and i can't! Any help would be much appreciated. Here, below, is a simplified version of my Vectorscript that works fine, and below that one example of how I have tried (and failed miserably) to translate it to Python: { V4 Simple Number Stamp Tool By: Benedick Miller Date: 2014-10-06 } Procedure SimpleNumberStamp; VAR n,i,keyhit:INTEGER; pt:POINT; t:STRING; BEGIN n:=IntDialog('Enter the starting number','1'); IF NOT DidCancel THEN keyhit:=27; i:=1; DSelectAll; while not keydown(keyhit) do begin t:=num2Str(0,n); getpt(pt.x,pt.y); TextOrigin(pt.x,pt.y); CreateText(t); n:=n+i; redrawall; end; END; Run(SimpleNumberStamp); And the Python translation: # Print Incremental Numbers on each mouse click until [Esc] # NOT WORKING!!! import vs def label(pt): vs.TextOrigin(pt[0],pt[1]) vs.CreateText(str(n)) vs.ReDraw() def kdwn(): k=vs.KeyDown() return k[1] keyhit = 27 i = 1 n = 1 vs.DSelectAll() n = vs.IntDialog('Enter the starting number', n ) if not vs.DidCancel(): while not kdwn() == keyhit: vs.GetPt(label) n = n + i
  11. 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
  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. <?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. <?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. 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?
  15. 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.
  16. 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.
  17. 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
  18. 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
  19. Why import vs number = "123" vs.Message("Type=", type (number) ) returns : "Types =" instead of "Types =int" ? Thanks
  20. 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
  21. 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")
  22. 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
  23. 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
  24. 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
  25. 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.
×
×
  • Create New...