Jump to content

DomC

Member
  • Posts

    605
  • Joined

  • Last visited

Everything posted by DomC

  1. The Script resets a ComputerWorks Multi-Stamp SDK PIO. For just PDF export I never would create a script. The main part is updating all stamp symbols. The real script does the following: 1. Importing (updating PIO graphic) symbols 2. Create a time and date value (thanks to python) 3. Update PIOs (The pio is linked to a record format which is importing data from an external source by another script) I love vectorscript and marionette. But I am always sceptical if a script is really is necessary. This is a border case for sure. #28.03.2018 #Alte Planköpfe mit neuen ersetzen vs.DSelectAll() listID, numItems = vs.BuildResourceListN(16, 'S:\\Vorlagen\\VectorWorks\\18_Offerte\\Vorgabe_Offerte_2018.vwx') sym_names = [] def callback(): pass for i in range(numItems): res_name = vs.GetNameFromResourceList(listID, i) sym_names.append(res_name) if res_name == 'SSSPK Küche A4': vs.ImportResToCurFileN(listID, i, callback) if res_name == 'SSSPK Küche A4q': vs.ImportResToCurFileN(listID, i, callback) if res_name == 'SSSPK Küche A4h': vs.ImportResToCurFileN(listID, i, callback) if res_name == 'SSSPK Küche Installation A4': vs.ImportResToCurFileN(listID, i, callback) if res_name == 'SSSPK Küche Installation A3': vs.ImportResToCurFileN(listID, i, callback) #Datum und Zeit vor PDF aktualiesiern Ja/Nein import datetime now = datetime.datetime.now() jahr = now.year; monat = '%02i' % now.month; tag = '%02i' % now.day; stunde = '%02i' % now.hour; minute = '%02i' % now.minute Datum = str(tag)+'.'+str(monat)+'.'+str(jahr) Zeit = str(stunde)+':'+str(minute) #Datum = 'DatumTest' #Zeit = 'ZeitTest' objs = [] def AktualisiereDat(): plankopf="INSYMBOL & INOBJECT & INVIEWPORT & (R IN ['Daten_ERP'])" def PlankopfFelder(h): vs.SetRField (h, 'Daten_ERP','114_Datum', Datum) vs.SetRField (h, 'Daten_ERP','115_Zeit', Zeit) objs.append(h) vs.SetObjectVariableBoolean(h,1167,True) vs.ResetObject(h) vs.SetObjectVariableBoolean(h,1167,False) vs.ForEachObject(PlankopfFelder, plankopf) auswahl = vs.YNDialog('Zeit, Datum aktualisieren?') if auswahl: AktualisiereDat() vs.DoMenuTextByName('Export PDF',0)
  2. Hi Mullin thanks for comment Yes thats the pragmatically solution which is running at the Moment -two separate scrips. Just tested Miguel's hint, and it works. Really Great! criteria="L = 'Lay-1'" objs = [] def BuildObjList(h): vs.SetFillBack(h, (4567,4123,78694)) vs.SetObjectVariableBoolean(h,1167,True) objs.append(h) vs.ForEachObject(BuildObjList, criteria) for h in objs: vs.ResetObject(h) vs.SetObjectVariableBoolean(h,1167,False) vs.DoMenuTextByName('Export PDF',0) Or even shorter and simpler: criteria="L = 'Lay-1'" def DoIt(h): vs.SetFillBack(h, (4567,4123,78694)) vs.SetObjectVariableBoolean(h,1167,True) vs.ResetObject(h) vs.SetObjectVariableBoolean(h,1167,False) vs.DoMenuTextByName('Export PDF',0)
  3. @Miguel Barrera I am not sure if I understand and I am think you mean playing with ObjectVariableBoolean 1167 I will try soon if I have time. Thank you for the hint! 
  4. Hi I have issues to reset a PIO before I export PDF. I tried: 1. Using vs.AcquireExportPDFSettingsAndLocation(True) and vs.OpenPDFDocument(bfbfab68-bd4e-11e6-a4a6-cec0c932ce01) and vs.ExportPDFPages('bfbfab68-bd4e-11e6-a4a6-cec0c932ce01') 2. Force PIO Regeneration by insert an Object in the PIO and delete that object 3. Creating a Reset Command and call this with DoMenuText and the call PDF Export I think PDF Export by script is supressing any reset of pios. So the Idea was, to search a function by force reset the objects. I think an attempt could by Any Ideas? criteria="L = 'Lay-1'" objs = [] def BuildObjList(h): vs.SetFillBack(h, (4567,4123,78694)) vs.ResetObject(h) vs.ForEachObject(BuildObjList, criteria) vs.DoMenuTextByName('Export PDF',0) Dialog Script.vwx
  5. The method to do this seems to first create the wanted structure with new folders (nesting begin and end folder). Then move the existing content to the new folders and delete the old folders. After that rename the new folders to the original names. An example, how to create a nested folder structure with a depth of 2 (parent folder, subfolder). It is based on 2 input lists from the same length which build the folder path. Example Input: fnames1 = ['Folder1','Folder1','Folder2','Folder2','Folder1'] fnames2 = ['SubFolder1','SubFolder1','SubFolder3','SubFolder2','SubFolder1'] The build a list of pathes: Folder1/SubFolder1 Folder1/Subfolder1 Folder2/SubFolder3 Folder2/Subfolder2 Folder1/Subfolder1 The Pathes can be duplicated in the List. The Script will fail if a Subfolder with the same name hat two different parent folders. fnames1 = ['Folder1','Folder1','Folder2','Folder2','Folder1'] fnames2 = ['SubFolder1','SubFolder1','SubFolder3','SubFolder2','SubFolder1'] created_folders = [] for i in range(len(fnames1)): fname1 = fnames1[i] if fname1 not in created_folders: #Folder does not exist vs.NameObject(fname1) vs.BeginFolderN(16) for n in range(len(fnames2)): fname2 = fnames2[n] parent = fnames1[n] if parent == fname1: #the parent folder of the processed subfolder matches if fname2 not in created_folders: vs.NameObject(fname2) vs.BeginFolderN(16) vs.EndFolder() created_folders.append(fname2) vs.EndFolder() created_folders.append(fname1)
  6. Solved it for a specific situation this way. Not very elegant but it works. The Error will happen, if one of the folders exists but in this case it was not necessary. sname = 'Symbol-2' fname1 = 'Folder-1' fname2 = 'Folder-2' sh = vs.GetObject(sname) #Symbol Name fh1 = vs.GetObject(fname1) #Folder Name Parent fh2 = vs.GetObject(fname2) #Subfolder Name if fh1 != vs.Handle(0) or fh2 != vs.Handle(0): #Name1 or Name2 in use if fh1 != vs.Handle(0): t = vs.GetType(fh1) if t != 92: # Object exists but is not a Symbol Folder fname1 = fname1+str(uuid.uuid4())[:8] vs.Message(fname1+' '+str(t)+' Achtung Name des Ordners existiert schon') if fh2 != vs.Handle(0): #Object altready exists t = vs.GetType(fh2) if t != 92: # Object exists but is not a Symbol Folder fname2 = fname1+str(uuid.uuid4())[:8] vs.Message(fname2+' '+str(t)+' Achtung Name des Ordners existiert schon') else: #Object do not exists vs.NameObject(fname1) vs.BeginFolderN(16) vs.NameObject(fname2) vs.BeginFolderN(16) vs.EndFolder() vs.EndFolder() fh1 = vs.GetObject(fname1) #New to the Objects, which are now Sym Folder for sure fh2 = vs.GetObject(fname2) vs.InsertSymbolInFolder(fh2, sh)
  7. Hi Someone knows how to move a symbol folder inside another symbol folder? The folder would be an empty folder Seems, that vs.GetParent(folder-2), returns folder-1. But if folder-2 is not inside folder-1 vs.SetParent(folder-2, folder-1) does not move the folder. Also tried vs.InsertSymbolInFolder(folder-1, folder-2). Maybe to try with nested BefinFolder, but this could be tricky with existing folders and symbols.
  8. It is possible But you have to code the Custom Dialoge. Attached an example with two popup and a sort node. Somehow by accident it goes in your usecase direction Custom Dialog.vwx
  9. Hi This is a very old thread I know. But it was the best I found in Forum. Anyone have an Idea, how to create section viewport?
  10. Version 1.0.0

    39 downloads

    Some Ressource Types (such as dimension standard or text styles) are handled by an index number. This node helps to find the index of those resources.
  11. Version 1.0.0

    44 downloads

    This node creates optional a rectangle and returns the corner points of that rectangle. Often there is a need of a rectangle and the corner points. If the rectangle is rotated, it can be a cramp to calculate the corner points. I hope this node can help to simplify marionette workflows.
  12. Version 1.0.0

    44 downloads

    This Node creates a new layer and keep the active layer the active one. It has a popup witch allows to choose sheet or design layer. It returns a handle to the new layer or a handle to an existing layer with the same name. Like ever .. with not warranty try first in an empty file and be careful creating thousands of layers or layers with the same name as other objects in the drawing.
  13. Version 1.0.0

    41 downloads

    Insert Symbol in Folder Node: 1. Move the Symbol with the input name in the folder with the input folder name 2. If folder do not exists it will be created. If no symbol name is inputted, the folder created also 3. If the folder name is taken by another object, the folder will not be created
  14. Version 1.0.0

    53 downloads

    What is the distance of the middle top point to the insertion Point (left bottom), if your rectangle has 175.5° degrees? Not so easy calculate the move vector or the rotation for that. This node can help you to use your time for other challenges. You can place your rectangles with every standard reference Point in any angle in degrees.
  15. Version 1.0.0

    147 downloads

    With this two nodes, we are able to set or get the parameter of an Marionette PIO or wrapper. Can be used to access the values in the OIP by script or another Marionette. The Screenshot shows an example in which every of those pillar is an own marionette PIO (Script as symbol to instance the PIO). Note: It is not possible to write the parameters via Worksheet. Also it is not possible to read Marionette Object parameters directly into a worksheet. To read Marionette object parameters in a worksheet I recommend to write data into a record format and list those values in a worksheet.
  16. Version 1.0.0

    25 downloads

    Some Objects needs to be Updated after Changing the Object Properties. In this cases this node can help you. Reset Object.vwx
  17. Puohh Cool example ... thanks for sharing, love that.
  18. Hi @ccsw Thank you very much for that input. There is a build in function "Marionette.Is2DObject (obj)". This checkes if an Object is 3D or if an Object is 2D. 2D and 3D are handled with other functions. At the release time of the node (maybe still, I did noch checked that) this function did noch correctly sort 2D and 3D Objects. So I think I just hardcoded the line "Is_2D_Obj = True #Marionette.Is2DObject (obj)" (It means that the node always handle objects as 2D) The line should be correctly (if the marionette function was correctly) "Is_2D_Obj = Marionette.Is2DObject (obj)". A new Version of the node is uploaded. Put by Ref Point v1.0.1.vwx
  19. We all would like to see more nodes But in this case I maybe want to see womenpower invested in other nodes than a second method to create spaces (can't see a real benefit of another node) This technique is already in full use in real practice. Attached a Screenshot I got from another user which automated his complete space creation and documentation with marionette. Did nod put it exactly together but about 30'000 m2 space area.
  20. I would take the Function Node and use the formula x[:-2] (to remove the last to items of the string, or x[:-1] to remove the last one etc.). There will be other possibilities with other nodes but I first had to search the right ones.
  21. Version 1.0.0

    57 downloads

    If you have many symbol definitions and have to link text to record fields. This Marionette can help you.
  22. Version 1.0.0

    17 downloads

    This is an enhancement of the standard locus point, with OIP Mastersnap or not.
  23. Version 1.0.0

    74 downloads

    This node sorts out all spaces which have a collision with one of the input objects. Can be used to detect, if a space contains a specific object. For collision points, the space polygon and the object's bounding box is used. There is a OIP dim parameter for tolerance value. The vwx contains a quick and dirty test floor plan, nothing real 🙂
  24. Seems I have somehow to trigger a change of the record format. At the moment the only workaround is to attach a new field to the record format which regenerate the info-palette popup. vs.NewField(record,'92d34ddb-8b38-4053-b688-4b3b960f5911.','0',4,0) Also tested vs.GetObjectVariablexxxx from 1 to 10000 vs.ResetObject(record) ... nothing help.
  25. @Alan WoodwellThanks for quick response Unfortunately the set Record Nodes (and the vs.SetRecordField), do not work on pupup fields without a further trick.
×
×
  • Create New...