
Gelde-Aart
Member-
Posts
22 -
Joined
-
Last visited
Reputation
12 GoodPersonal Information
-
Location
Netherlands
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
Could not create roof, probably not enough walls
Gelde-Aart replied to ge25yak's topic in Python Scripting
Hi ge25yak, Your roof_vertices list should be counter clockwise: roof_vertices = [(0, 0), (5000, 0), (5000, 3000), (0, 3000)] Don't ask me why... -
After some further testing it seems that the issue is not Python (even got back to Vectorscript for this...) , but the tool being event driven (forgot to mention...). when the tool is 'normal' (for both Python and Vectorscript) a parameter will be read. Converting the tool to an event driven one raises errors...
-
HI, I try to get the a parameter value from a tool (.vst), but the Vectorscript way (vs.PParameter ) does not seem to work: has anybody success in retrieving a parameter value and how did you do it? Thanks in advance! Gelde-Aart
-
@AlHanson did you succeed in retrieving the edited data? The SetLBItemReadonly only makes the LBitem editable, but a function to get the edited data does not seem to exist...
-
Just a small addition: it is possible without a dialog to have the button show a resource selector by using vsoButtonGetResource, it is probably a bit slower but just give it a go. The attachment is a modification of @Jesse Cogswell PIO (just a bit of sugar of me) Event Enabled Example v2.vso
-
🙂 was a quick and dirty porting at my side...
-
Hi Tui, Below an example script (I had to port and clean it from Vectorworks 2013): kLB001 = 4 kPB_Expand = 5 kPB_Collapse = 6 import vs def dialogHandler(item, data): if item == 12255: nCol = vs.InsertLBColumn(dialID,kLB001,0,'Item',150) bResult = vs.SetLBControlType(dialID,kLB001,0,1) bResult = vs.SetLBItemDisplayType(dialID,kLB001,0,3) #Some Lines to fill the listbrowser nItem = vs.InsertLBItem(dialID,kLB001,0,'2D-Axis') nItem = vs.InsertLBItem(dialID,kLB001,1,'2D-Cap') nItem = vs.InsertLBItem(dialID,kLB001,2,'2D-Housing-Back') nItem = vs.InsertLBItem(dialID,kLB001,3,'2D-Housing-Frame') nItem = vs.InsertLBItem(dialID,kLB001,4,'2D-Housing-Glass') nItem = vs.InsertLBItem(dialID,kLB001,5,'2D-Leaf-Back') nItem = vs.InsertLBItem(dialID,kLB001,6,'2D-Leaf-Frame') nItem = vs.InsertLBItem(dialID,kLB001,7,'2D-Leaf-Glass') nItem = vs.InsertLBItem(dialID,kLB001,8,'3D-Axis') nItem = vs.InsertLBItem(dialID,kLB001,9,'3D-Cap') nItem = vs.InsertLBItem(dialID,kLB001,10,'3D-Housing-Frame') nItem = vs.InsertLBItem(dialID,kLB001,11,'3D-Housing-Glass') nItem = vs.InsertLBItem(dialID,kLB001,12,'3D-Leaf-Frame') nItem = vs.InsertLBItem(dialID,kLB001,13,'3D-Leaf-Glass') vs.EnableLBSorting(dialID,kLB001,False) vs.SetLBHierDispColumn(dialID,kLB001,0) vs.EnableLBHierDisplay(dialID,kLB001,True) global numLBItems #has to be a global, otherwise it won't work... numLBItems = vs.GetNumLBItems(dialID,kLB001) elif item == kLB001: LBrecursive = True bResult = vs.GetLBEventInfo(dialID,kLB001,LBeventType,LBrowIndex,LBcolumIndex) if vs.HierLBItemIsClosed(dialID,kLB001,LBrowIndex): numbRedisplItems = vs.HierLBItemOpened(dialID,kLB001,LBrowIndex,False) else: vs.HierLBItemClosed(dialID,kLB001,LBrowIndex,False) elif item == kPB_Expand: for i in range(numLBItems): if vs.HierLBItemIsClosed(dialID,kLB001,i): numbRedisplItems = vs.HierLBItemOpened(dialID,kLB001,i,True) elif item == kPB_Collapse: for i in range(numLBItems): if vs.HierLBItemIsClosed(dialID,kLB001,i) == False: vs.HierLBItemClosed(dialID,kLB001,i,True) def rundialog(): global dialID dialID = vs.CreateResizableLayout('Test Listbrowser',True,'OK','Cancel',False,False) vs.CreateLB(dialID,kLB001,60,20) vs.CreatePushButton(dialID,kPB_Expand,'Expand') vs.CreatePushButton(dialID,kPB_Collapse,'Collapse') vs.SetFirstLayoutItem(dialID,kLB001) vs.SetRightItem(dialID,kLB001,kPB_Expand,0,0) vs.SetBelowItem(dialID,kPB_Expand,kPB_Collapse,0,0) if vs.RunLayoutDialog(dialID,dialogHandler) == 1: pass rundialog() Cheers, Gelde-Aart
-
Create a texture resource from image in a folder
Gelde-Aart replied to jonasfehr's topic in Python Scripting
Hi Jonas, From Vectorworks 2019 and newer it is possible to create a image based texture by using CreateTextureBitmapD (before you had to use a dummy texture...) #Part 1 - import and convert image hPaint = vs.ImportImageFile(thePath, 0,0) #Needs to be deleted afterwards hImage = vs.CreateImageFromPaint(hPaint, 'Just_a_name') #Part 2 - Create ShaderRecord and convert to TextureBitmap hShaderRec = vs.CreateShaderRecord(hTexture, 1, 41) #1 = Color image hTextureBitMap = vs.CreateTextureBitmapD( hShaderRec) #Part 3 - Connect the image to the TextureBitmap vs.SetObjectVariableHandle(hTextureBitMap, 528, hImage) #Were the magic happens! Hope this helps. 🙂 Gelde-Aart -
Slab style and roof style resource id's?
Gelde-Aart replied to Peter Vandewalle's topic in Vectorscript
Roof Styles = 102 Slab Styles = 107 -
How to assign a texture to a 3D object (Solved)
Gelde-Aart replied to Carles Olle's topic in Python Scripting
Dave your right: 3 is overall, but don't know why it also did work with the 0 as texturePart... Did a quick backwards test with an extrude and it seems that 3 is overall, 0 are the sides, 4 is the Top and 5 is the Bottom of an extrude. -
How to assign a texture to a 3D object (Solved)
Gelde-Aart replied to Carles Olle's topic in Python Scripting
To assign a texture to the 3D object use the vs.SetTextureRefN(obj, textureRef, texPartID, texLayerID), so your script would look like: vs.BeginPoly3D() vs.Add3DPt((-5, 0, -5)) vs.Add3DPt(( 5, 0, -5)) vs.Add3DPt(( 5, 0, 5)) vs.Add3DPt((-5, 0, 5)) vs.Add3DPt((-5, 0, -5)) vs.EndPoly3D() image = vs.LNewObj() textureRef = vs.Name2Index("Test texture") texPartID = 0 texLayerID = 0 vs.SetTextureRefN(image, textureRef, texPartID, texLayerID) In the above the texPartID is the primary and the texLayerID is about the base object (0) or decals(1 and further). -
Layer number Position of a design layer and management SOLVED
Gelde-Aart replied to avictorgm's topic in Python Scripting
The position of a new layer can be set by using the vs.HMoveBackward(h, toBack) see also the post on Layer Stacking Order:- 3 replies
-
- design layer
- layer
-
(and 1 more)
Tagged with:
-
Persistent highlight of object during dialog
Gelde-Aart replied to Gelde-Aart's topic in Python Scripting
Thanks! During the dialog I'm using the Redraw() to regen the objects and it works! -
Persistent highlight of object during dialog
Gelde-Aart replied to Gelde-Aart's topic in Python Scripting
Thanks! What I'm after is from a PIO, using a button to show a dialog like the Subtract solid, to 'highlight' which part of the object will be edited. I already thought about a temporary object, but it only got created after the dialog closed... perhaps you know a way to create a temporary rectangle within the Begin and Endcontext()? A second option would be to use a SymbolDisplayControl within the dialog, but somehow that seems like an overkill... Any Ideas for the first option are welcome! -
Is it possible to have a persistant higlight of objects like with the Subtract Solids command dialog, whereas one can traverse through the selected objects during the dialog?