Jump to content

Gelde-Aart

Member
  • Posts

    16
  • Joined

  • Last visited

Reputation

8 Neutral

Personal Information

  • Location
    The Netherlands

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 🙂 was a quick and dirty porting at my side...
  2. 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
  3. 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
  4. 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.
  5. 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).
  6. The position of a new layer can be set by using the vs.HMoveBackward(h, toBack) see also the post on Layer Stacking Order:
  7. Thanks! During the dialog I'm using the Redraw() to regen the objects and it works!
  8. 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!
  9. 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?
×
×
  • Create New...