Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

3 Neutral

About jonasfehr

  • Rank

Personal Information

  • Location
  1. I don't think so, I can't find any function which returns just some selected files after a folder dialog. But you could add a condition, and just create textures, when the naming fit's some criteria... if "xxx" in name : #create the texture
  2. Here my complete script to choose a folder and import the images as rendertexture: import os major, minor, maintenance, platform = vs.GetVersion() isMac = False if platform == 1: isMac = True # define a location to import the images importPt = (0,0) symCreatedCnt = 0 err, dirPath = vs.GetFolder( 'Select a Folder' ) if err == 0: # no-error hsfDirPath = dirPath if isMac: ok, hsfDirPath = vs.ConvertPosix2HSFPath( dirPath ) fileIndex = 1 while True: # loop the files fileName = vs.GetFilesInFolder( hsfDirPath, fileIndex ) fileIndex += 1 if fileName == '': # no more files break name, ext = os.path.splitext( fileName ) if ext.lower() == '.png' or ext.lower() == '.jpg': imagePath = os.path.join( dirPath, fileName ) hPaint = vs.ImportImageFile(imagePath, 0,0) #Needs to be deleted afterwards hImage = vs.CreateImageFromPaint(hPaint, 'Just_a_name') hTexture = vs.CreateTexture() vs.SetName(hTexture, name+"_tex") hShaderRec = vs.CreateShaderRecord(hTexture, 1, 41) #1 = Color image hTextureBitMap = vs.CreateTextureBitmapD( hShaderRec) vs.SetObjectVariableHandle(hTextureBitMap, 528, hImage) #Were the magic happens! vs.DelObject(hPaint) symCreatedCnt += 1 vs.AlrtDialog( 'Done! Imported ', symCreatedCnt , ' images to textures.' ) Hope it is beneficial for other too...
  3. @Gelde-Aart posted a python script solution in following thread:
  4. I was missing the magic... thanks a lot! @Gelde-Aart you are my hero....
  5. Hi, did you manage to create a plugin for this? I was also looking into a python solution, but it seems not to be possible. Kind reagards Jonas
  6. Following forum entry says it's not possible with python can someone verify this?
  7. I got so far, to create a texture, and add a shaderrecord set to color / image. But how to add a path to a image? h_text = vs.CreateTexture() h_shaderRecord = vs.CreateShaderRecord(h_text, 1, 41) # color image
  8. Hi, I try now to subdivide my question from my previous post - Looking for script to import images as imageprop. Does anyone have a good approach to create a texture resource from images loaded from a folder. I found the example script to load images as symbols(https://developer.vectorworks.net/index.php/Python_Sample_Import_Images_as_Symbols), but I can't figure out how to bind them to a renderworks texture. Afterwards the texture could be used on an extruded object or with a image prob. Cheers Jonas
  9. 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
  10. Thanks, I really apprechiate your feedback. I'll think a little about what would be smartest four our purpose. Do you have any suggestions regarding step 4 & 5. How I can search for specific object within a symbol def? I may still haven't understood the overall logic behind objects. As I understand it now, they can be almost anything. So how can I for example loop through just the objects within the symDef? And how to identify for eksample a 3D plane?
  11. Thanks PatW and Pat S. for your quick responses. It is fine just to work with the naming of the LightDevices (LDs), what I need is the absolut placement of the components inside the LDs. So my idea is following: search for the LDs getTheirPosition find their corresponding Symbol Definition (symDef) find the components i need inside the symDef. combine the relative positioning of the components in de symDef with the absolute position of the LDs. write these positions to my spreadsheet, make them unique identifiable to their "parent" with the given UnitNumer from the LDs Does this approach make sense? Following skript does the first 3 steps, but now I have difficulties to identify the objects of interest inside the symDef. It's mainly a plane, which i need the center position, size and orientation from. ld_list = [] # list to store handlers to light devices def collect_LightDevices(h): ld_list.append(h) vs.ForEachObject(collect_LightDevices, "((R IN ['Lighting Device']))" ) for ld in ld_list: # find the symname of the stands h = vs.FInGroup(ld) while vs.GetTypeN(h) != 15: h = vs.NextObj(h) print(vs.GetSymName(h)) symDef = vs.GetObject( vs.GetSymName(h) ) h = vs.FInGroup(symDef) # here I got stuck how to identify the objects of interest # so far I have been using class naming to identify them but is there a smarter way?
  12. Hi, Is it somehow possible to access the export panorama function from a script? Or any other ideas for a batch rendering routine? Kind regards Jonas
  13. Hi, I am quite new to vw, but have been programming for many years now. Unfortunately I have a very hard time understanding the API and how to use it. For a project I am working on, I need to export the position, rotation etc. of certain planes and render cameras, as the naming is crucial and we need to be able to simply redesign and replace objects, we would like to use the built in tools from spotlight. So far, I managed to find the handles of objects based on predefined classes [ForEachObject(...)], and am able to export their position and naming to a csv table. But when it comes to symbols i hit a wall. I am able to define the search criteria looking for a symbols name, which works if its a standard symbol, but when I try to do the same for the symbol associated with a lighting device (or is it called instrument), it is not found. When I have found the handle to a specific symbol, how I am not able to go into the symbol/object and access components/objects inside of it. Can anyone help me out? Here the main questions I have are: How do I access the components/objects inside a symbol / lighting device? How can i create a search criteria for Lighting Devices (not lights)? Can anyone point me to a good collection of scripts I could use as reference? Sorry if I use the wrong terminology to describe my problem. Actually that's another confusion - How to name the different components? I hope anyone can help me out kind regards Jonas import vs import os, sys, stat import numpy as np import pandas as pd handlersList = [] # list to store handlers to the cameras symbolsList = [] # list to store handlers to symbols #vs.AlrtDialog(); def collect_Symbols(h): symbolsList.append(h) vs.ForEachObject(collect_Symbols, "( (C ='Stands') )" ) def collect_handlers(h): handlersList.append(h) vs.ForEachObject(collect_handlers, "( (C ='ContentPlaceHolder') | (C ='RenderPoints') )") #vs.AlrtDialog(len(handlers)); databased_export = [] for i, h in enumerate(handlersList): #symbolName = vs.GetSymName(h) className = vs.GetClass(h) name = vs.GetName(h) posXY, posZ = vs.Get3DCntr(h) w, h, d = vs.Get3DInfo(h) #hasOri, xRot, yRot, zRot, isMirroredXY = vs.Get3DOrientation(h) databased_export.append([className, name, posXY[0], posXY[1], posZ, w, h, d]) #, xRot, yRot, zRot]) columns = ["className", "name", "posX","posY", "posZ", "w", "h", "d"]#, "xRot", "yPot", "zRot"] dataframe = pd.DataFrame(databased_export, columns=columns) script_path = os.path.split(vs.GetFPathName())[0] dataframe.to_csv(os.path.join(script_path, "ExportForPano2VR.csv")) # store dataframe in csv for external checking


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