Jump to content

Sebastiaan

Member
  • Posts

    338
  • Joined

  • Last visited

Everything posted by Sebastiaan

  1. There is a Coffee Break seminar on the VW university about exactly this subject. It might be worth it to watch that one. some tips may be unexpected like images used in a title block can increase file size.
  2. Hi Pat, Thank you. I must admit I was secretly hoping for you. But by not having the time you motivated me to do it myself ;-). I couldn't let it go and I now have it working for the second level with nested folders too! There are a couple of items in the import that could have been in a third folder but I am not going to bother with that. Very happy with the result and that I managed myself. See the code and example file below: symid = vs.FInFolder( vs.GetObject( 'DXF_DWG' ) ) fldrlist = [] symlist = [] while vs.GetTypeN(symid)==16: symname = vs.GetName(symid) symsub = vs.SubString(symname,'_',2) if symsub not in fldrlist: fldrlist.append(symsub) symlist.append(symname) symid=vs.NextSymDef(symid) cntsym = (len(fldrlist)) cntsym2 = (len(symlist)) sym=symid scndlist = [] for i in range(len(fldrlist)): fldr1 = fldrlist[i] for j in range(len(symlist)): symname = symlist[j] scndfldr = vs.SubString(symname,'_',3) chkfldr = vs.SubString(symname,'_',2) if scndfldr not in scndlist and chkfldr == fldr1 and symname.count('_') >= 3: scndlist.append(scndfldr) vs.NameObject(fldr1) vs.BeginFolderN(16) for k in range(len(scndlist)): fldr2 = scndlist[k] vs.NameObject(fldr2) vs.BeginFolderN(16) vs.EndFolder() vs.EndFolder() scndlist.clear() for i in range(len(symlist)): symname = symlist[i] if symname.count('_') >= 3: fname = vs.SubString(symname,'_',3) else: fname = vs.SubString(symname,'_',2) insrtfldr = vs.GetObject(fname) insrtsym = vs.GetObject(symname) vs.InsertSymbolInFolder(insrtfldr, insrtsym) Folder script.vwx
  3. update: I managed to get a script working for creating folder based on a substring of the symbol names. And placing the symbols in their corresponding folders. This does not create nested folders yet, but I may leave it at this an enough of a satisfactory result. Maybe I could get it to work to create multiple nested folders if I make a list with a sublist of substrings or something like that. symid = vs.FInFolder( vs.GetObject( 'DXF_DWG' ) ) fldrlist = [] symlist = [] while vs.GetTypeN(symid)==16: symname = vs.GetName(symid) symsub = vs.SubString(symname,'_',2) #vs.AlrtDialog(symsub) fldrlist.append(symsub) symlist.append(symname) symid=vs.NextSymDef(symid) cntsym = (len(fldrlist)) vs.AlrtDialog(cntsym) sym=symid if vs.GetTypeN(sym)!=16: vs.AlrtDialog('All symbols shown') i = 1 while i < len(fldrlist): fname = fldrlist[i] chkfldr = vs.GetObject(fname) if chkfldr == 0: #vs.AlrtDialog(fname, ' ', chkfldr) vs.NameObject(fname) vs.BeginFolder() vs.EndFolder() i = i + 1 i = 0 while i < len(symlist): symname = symlist[i] fname = vs.SubString(symname,'_',2) insrtfldr = vs.GetObject(fname) insrtsym = vs.GetObject(symname) #vs.AlrtDialog(insrtsym) vs.InsertSymbolInFolder(insrtfldr, insrtsym) i = i + 1 #vs.AlrtDialog(vs.SubString(Symname,'_',2))
  4. Maybe this topic should be moved to the Python forum because I have been trying some different code snippets in Python. I can create a folder in a folder or even two folders in one folder with the below code. It would only have to be made dynamic based on then delimited substrings of the symbols. vs.NameObject('Audio') vs.BeginFolderN(16) vs.NameObject('AudioSubfolder') vs.BeginFolderN(16) vs.EndFolder() vs.NameObject('AudioSubfolderSCND') vs.BeginFolderN(16) vs.EndFolder() vs.EndFolder() I can loop through a list of symbols in a folder and place a symbol in it's folder based on the last substring delimited by '_' However some how it only places one symbol in its folder I have to run the script again to get the next one in its folder? symid = vs.FInFolder( vs.GetObject( 'DXF_DWG' ) ) while vs.GetTypeN(symid)==16: symname=vs.GetName(symid) symdepth = symname.count('_') fname = vs.SubString(symname,'_',symdepth) insrtfldr = vs.GetObject(fname) insrtsym = vs.GetObject(symname) vs.InsertSymbolInFolder(insrtfldr, insrtsym) #vs.AlrtDialog(symdepth,fname) symid=vs.NextSymDef(symid) So making small steps, it has just been to long ago since I coded anything and these bit of code are copied from various topics. Would anyone be willing to give me a push?
  5. Ok different aproach. I used an Automator finder quick action to batch rename the DWG's with a prefix based on the nested folders that the DWG's are in. Before the name was Product abc.dwg and below is the result. This is an anonymised example file and folder structure. I can now import the DWG's as symbols into 1 file and this will at least sort the imported symbols in the recourse manager in the same order as the folder structure. With two example files this import wil look like this in the RM: Now would it be possible with a script to loop through the symbols in the RM and create folders and subfolders based on the prefixes delimited by the '_' in the symbol? The desired result would look like this: As far as I can see there won't be an issue with the 63 character limit looks like I am staying under that. The actual data set has 1000's of dwg's to convert so manual operation is not really an option. The sorted import list is already sort of workable, but if the above script would be possible I would be forever grateful.
  6. Hi, I have a set of many tiny DWG's spread across dozens of folders that I would want to import in place into VW files. When I use the import DWG/DXF command then I can import all DWG's into one folder or all DWG's into one file. But what I would really want is is to have a batch import where for each folder of DWG's the import is done into that folder either one VW file with all DWG's from that folder or if that's not possible for each folder containing DWG's the import is done into that folder with one VW file per DWG file. Even more I would want the DWG geometry to be imported as symbols into the VW files. Would something like this be possible or should I start thinking about apple script?
  7. Make sure that the field you want to number has a ✅ in the column ont the left of the window. also when you want to alter the setting of the field make sure that you click on the field name on the left and that it is highlited blue when you enter something in the field settings. these two are the most common user errors to check.
  8. Are these older drawings? In my files there is no “Channel Number” field. Just “channel” without the number.
  9. Are you using a saved set to recall your channel numbering setting? In this case there is a bug that sets the number of units per increment to zero. also make duren that when adjusting the field you want to number. That this field is highlighted blue in de spotlight numbering window. Only the field that is highlighted will be adjusted.
  10. Make sure the unified view is on. It is in the view menu
  11. What helped for me in some cases, not al unfortunately. was to go into the edit 3d components of the truss symbol. And to move the geometry there for instance 1mm in 3D. This would force the geometry to appear again in OpenGL. Then I edited 3D again and moved the geometry back 1mm again. hopefully this helps a little bit as a temporary workaround.
  12. the function already exists in Data Tags. It’s called a dynamic text field and I would really want to be able to use a dynamic text field in Label Legends!
  13. there is a new workflow for multicell fixtures in VW 2021. You can find explanation about the new function here. https://app-help.vectorworks.net/2021/eng/index.htm#t=VW2021_Guide%2FLightingDesign1%2FConcept__Multi-cell_lighting_devices.htm&rhsearch=Multi cell&rhhlterm=Multi cell&rhsyns=
  14. Hi All, I am trying to get my head around manipulating accessories through Python scripts. Ultimately I would like to be able to position an accessory by a criteria such as the accessory name. I wonder if that is even possible as the function reference only seems to give handles to accessory index and not the name, but that is for a later step. As a novice on scripting I am getting stuck on getting the GetAccPos3D & SetAccPos3D to do anything at all at this moment. First I tried GetAccCount which worked instantly: crit = "((R IN ['Lighting Device']))" def callback(h): NumAcc = vs.LDevice_GetAccCount(h, 0) vs.AlrtDialog(NumAcc) vs.ForEachObject(callback, crit) Then I tried GetAccPos3D, and the script seems to run but does not do anything. I tested the ForEachObject with a test string in an Alert dialog in the Callback, so I am sure that this does step through the lighting devices. Also I tried various combinations of the Accessory index and Cell index, but to no avail. My assumption is that a single cell lighting device would have cell index 0, and in the OIP I can see that the Accessory I am trying to manipulate has #2 as prefix before it's name in the dropdown. So I assumed that the accessory index is 2. Nonetheless I tried many other combinations as well. Also I am uncertain on how to handle the fact that this function returns multiple values. crit = "((R IN ['Lighting Device']))" def callback(h): outRotation3D, outPosition3D = vs.LDevice_GetAccPos3D(h, 0, 2) vs.AlrtDialog(outRotation3D) vs.AlrtDialog(outPosition3D) vs.ForEachObject(callback, crit) Would anyone be able to push me in the right direction?
  15. For Universe and address field since VW 2020 there is the ‘Universe/Address’ Field that Automatically combines the two fields together with a separator. You can change the separator if you like in the spotlight preferences. for other fields I recommend the AutoplotVW plugins. It has a menu command called ‘copy field to field’ that will do what you want.
  16. I do agree with this! Please give the option back to us. This has saved many hours of work getting viewports from one file to another. You do not have to advertise it as a recommended function. Just let us use it as the workaround that it was please?
  17. There is no dropdown there. You need to click on the word none in the row of the field that you want to add the container to. Click until it reads the desired container name. when you open the Label legend Manager for the first time 4 default containers are automatically added to your document ( circle, triangle, Rectangle and hexagon). They are placed as 2D symbols in a folder named Containers in the recourse manager. if that is not the case in your file you could try to open a new file and open the LL manager and then import the created container folder with it’s contents to the file you are working in. Also you can create containers yourself. If you crate a 2D symbol and place it in the folder named Containers, it will then become available to use in the label legend manager. The insertion point of the containers 2D symbol will be placed at the center point of the text field that you apply it to.
  18. Really interesting Pat! Thank you! I will now spend my time trying to actually understand what the code does.
  19. Interesting! Although as I’ve only just plunged into the the world of scripting in VW, I might need some more practice until I attempt that!
  20. Good idea to use the wildcards. That might make it shorter indeed. I will look into that. I do want 100 to belong to the 1 -> 100 range, but that shouldn't be too hard to fit in. I was trying to find some information on the database by script function and did not see much information about in. But I am curious what it is.
  21. Yes I was guessing that too. It also kinda makes sense when you think of it. There is no cell to represent as value. The function does not change the original database and would have to create a new list of the fields as number values which obviously it doesn’t. I already have the workaround so it is what it is. At least I now know it’s not just me. thank you!
  22. Hi Raymond, The issue is that I think that the value function does not work as expected when used in a DB formula. So your proposed formula does not do the trick either. Thanks!
  23. Hi Pat, Of course, attached is a file with 40 lighting devices. 20 of them have the channel field filled with numbers from 1 to 20. the other 20 have numbers in the channel field from 101 to 121. Very curious if this will work in a DB formula. DB Formula Value Fun.vwx
  24. I tried the formula below and this does not work either: =DATABASE((NOTINREFDLVP & NOTINDLVP & (PON='Lighting Device') & (VALUE('Lighting Device'.'Channel')>=1) & (VALUE('Lighting Device'.'Channel')<=100))) When lighting devices do not yet have a channel number assigned then the field will be an empty string (''). Would that cause a value function to fail too? That would be the only exception to a number in the text field. I was already able to use the lengthy version in a script (with a variable in each of the 100 criteria and about 600 backslashes to escape the apostrophes ;-). So it works, but was curious if it could be shorter.
×
×
  • Create New...