connered Posted December 26, 2014 Share Posted December 26, 2014 Hey, I`m new to Vector Works and try to write a script to place objects from Library files to the scene . Can someone give me a start point for that ? Thanks Quote Link to comment
Justin Smith Posted December 26, 2014 Share Posted December 26, 2014 (edited) Here's my base functions that load up a symbol in the folder inside my plugins user folder called "JRSPlugins/JRSPythonProjectsLinked/VWXSymbols" I have a gist of this code here: https://gist.github.com/justinmilo/d85a048cb1ec4ce54270#file-jsbase-py ef JRSymbol(name, x, y, rotation): if not symbolExists(name): importSymbol(name) vs.Symbol(name, x, y, rotation) return vs.LNewObj() def importSymbol(id): aListID = 1 objectType = 16 #Symbol Index folderIndex = -2 # Plug-In Data Folder (negative means user folder) aListID, numOfItems = vs.BuildResourceList( objectType , folderIndex, "JRSPlugins/JRSPythonProjectsLinked/VWXSymbols") aString = "" for i in range(0, numOfItems): #myInt = vs.InsertImagePopupResource (dialog1, 4, aListID, i) name = vs.GetNameFromResourceList (aListID, i) if name == id: vs.ImportResourceToCurrentFile(aListID, i) def symbolExists (id): objectType = 16 #Symbol Index folderIndex = 0 # Current Document aListID, numOfItems = vs.BuildResourceList( objectType , folderIndex, "") for i in range(0, numOfItems): name = vs.GetNameFromResourceList (aListID, i) if name == id: return True return False def Symbol2D3D(SymString, X, Y, Z, Xr, Yr, Zr): JRSymbol (SymString, X, Y, Xr) vs.Move3DObj(vs.LNewObj(), 0, 0, Z)# to move an individual Edited December 26, 2014 by Justin Smith Quote Link to comment
connered Posted February 3, 2015 Author Share Posted February 3, 2015 i try to use your source - where do you call the Symbol3D or Symbol2D3D by direct call i get an error "Error: Statement must follow creation of a 3D object." Quote Link to comment
Justin Smith Posted February 8, 2015 Share Posted February 8, 2015 Hmm, possibly I've only used this to import Hybrid or 3D symbols. Let me look into this Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.