Jump to content

DomC

Member
  • Content count

    331
  • Joined

  • Last visited

Community Reputation

106 Spectacular

About DomC

  • Rank
    Journeyman

Personal Information

  • Location
    Switzerland

Recent Profile Visitors

2,346 profile views
  1. DomC

    PDF Export, ResetObject

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

    PDF Export, ResetObject

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

    PDF Export, ResetObject

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

    PDF Export, ResetObject

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

    Symbols and Folder Locations

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

    Symbols and Folder Locations

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

    Symbols and Folder Locations

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

    Custom Dialog Box In Marionette Menu Script

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

    Creating Viewports using a script.

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

    Name2Index

    Version 1.0.0

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

    Point Rectangle

    Version 1.0.0

    5 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

    4 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

    2 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

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