Jump to content

PatW

Member
  • Posts

    85
  • Joined

Everything posted by PatW

  1. You could populate a recordfield with all the string (comma seperated) and acces it from outside. regards, Patrick
  2. PatW

    Explode

    Hi Chansson, it was intended to work like this, but I just noticed that "Get Gravity Center" is returning 0 always for groups. Take a look at the Marionette Object examples where the group is the control geometry.
  3. What does the error say?
  4. Seems like VW does not offer a function but you could try this hack: - Convert the line into a temp. Solid (extrude along path) - Intersect it with the other solid: http://developer.vectorworks.net/index.php/VS:IntersectSolid By the error you should be able to tell if the objects intersect. regards, Patrick
  5. No problem, you can find it in <VW Programfolder>\Plug-Ins\Marionette.vwr\Scripts\. Just open the VWR with a zip program like 7Zip.
  6. Here is the implementation from the Marionette.py def VerifyOrGetLib(missingLib, missingLibURL): # try to install user's package exit_code = False appfolder = vs.GetFolderPath(1) appuserfldr = vs.GetFolderPath(12) cmd = 'Python Externals' cmd = appuserfldr + cmd if not os.path.exists(cmd): os.makedirs(cmd) try: try: importlib.import_module(missingLib) exit_code = True except ImportError: #show dialog here question = 'Python module ' + missingLib + ' is not installed. Would you like to download and install it now?' res = vs. AlertQuestion(question,'', 1,'','','','') if res == 1 : if sys.platform == 'win32': piploc = 'Python35\Scripts\pip3.exe' pathpip = 'Python35\Scripts' cdpath = os.path.join(appfolder, pathpip) cmdpip = os.path.join(appfolder, piploc) wd = os.getcwd() if os.path.exists(cmd) and os.path.exists(cmdpip): os.chdir(cdpath) ret_code = subprocess.call([cmdpip, 'install', missingLibURL, '-t', cmd ]) if ret_code > 0: vs.AlrtDialog('Module ', missingLib, ' cannot be downloaded.') exit_code = False else: exit_code = True sys.path.append(cmd + '\\') os.chdir(wd) vs.AlrtDialog('Module ', missingLib, ' has been successfully installed.') elif sys.platform == 'darwin': import pip import shlex pos1 = missingLibURL.rfind('/') pos2 = missingLibURL.rfind('whl') downloadedfile = missingLibURL[pos1+1:pos2] +'whl' destination = appuserfldr + downloadedfile command_line = "curl -o " + '\"' + destination + '\"' + " "+ missingLibURL args = shlex.split(command_line) ret_code = subprocess.call(args) if ret_code == 0: sys_executable_orig = sys.executable sys.executable = '/usr/bin/python' ret_code = pip.main(['install', destination,'-q','--target', cmd]) sys.executable = sys_executable_orig if ret_code > 0: vs.AlrtDialog('Module ', missingLib, ' cannot be installed.') exit_code = False else: vs.AlrtDialog('Module ', missingLib, ' has been successfully installed.') exit_code = True else: vs.AlrtDialog('Module ', missingLib, ' cannot be installed.') exit_code = False sys.path.append(cmd+'/') else: exit_code = False except: pass return exit_code regards, patrick
  7. sry, oversaw that you already found doms post.
  8. Hi Takeshi, I asume you checked a parametric record, in this case the number would be "3". Did you see the different tables in the doc. Data Record: -"4" Text (Didn't check it, but the pop up must be text in that case, ) -"8" Number-fractional Param Record: - "3" Number (Equivalant to 8 off Data Record) - "8" Pop-Up regards, Patrick
  9. In case no one comes up with a better solution you could try it by checking the referenced files for the symbol. When the symbol you want to check is in the resource list off the file it should be referenced. (I assume that ther ewould be conflict when you reference a file that has sym "A" and sym "A" is already in the master file). VectorWorks::TVWArray_ReferencedFileInfo outRefFilesInfo; gSDK->GetReferencedFilesInfo(outRefFilesInfo); VectorWorks::SReferencedFileInfo info = outRefFilesInfo.GetAt(0); // Iterate trough the total count info.winFilePathName; // Build a resource list and check if the Symbol is contained. http://developer.vectorworks.net/index.php/VS:BuildResourceListN regards, Patrick
  10. Hi Jim, this command moved to the context menu and is now called "Customize Truss Sysmbol Data.."
  11. Hi Ivers, here is a little example that gives you the count off the dataTag objects. What you need to do is simply replace the counting by the set class function: crit = "((R IN ['Data Tag']))" count = 0 def callback(h): global count count += 1 vs.ForEachObject(callback, crit) vs.AlrtDialog("Counted ", count, " DataTags")
  12. We are using VW2020. auto statTX = GetStaticTextCtrlByID(kedtitDim_EffLengthBasket); Uint8 R = 255; Uint8 G = 0; Uint8 B = 0; CRGBColor color(R, G, B); statTX->SetColor(color, false /*atDialogInitTime*/ ); I was calling this in DispatchEvent and OnUpdateUI without any effect. What we want is to make the static text red dynamically when a value is invalid.
  13. I was not able to change the color with this funciton(also SetStyle is not working) is there any trick or alternative function?
  14. The defined params are stored in the ParamRecord which has the name off the ParamObjectType. First you need to get the param rec name, thats saver than hardcoding it: http://developer.vectorworks.net/index.php/VS:GetParametricRecord Put the handle in this function: http://developer.vectorworks.net/index.php/VS:GetName At the end you pass the paramObject, the name off the param record and the Fieldname into this function: http://developer.vectorworks.net/index.php/VS:GetRField
  15. VS function's throw no exceptions. The errors are basically prints. You can check a handle like a boolean to see if its valid: if not vs.GetObject(SymName): # XXX error # If another obj type could have the name this might be saver: kSymbol_Definition = 16 h = vs.GetObject(SymName) if (vs.GetTypeN(h) != kSymbol_Definition): # XXX error
  16. ForEachObjectInList needs a callback function you can do the selection inside there instead off looping a list. Theres a good example on: http://developer.vectorworks.net/index.php/VS:ForEachObjectInList regards, Patrick
  17. Hi CETLV, are definitely only the objects that we see on the picture in the drawing? When calculating "All" Braceworks consideres also objects that are hidden. I would take a look into the file if you can share it.
  18. The windows equivalent to AppleScript would be ActiveX here: Unfortunately it's not documented and very unstable. If you are lucky it will work.
  19. You need to provide the internal plug-in name, usualy this is the name that you see in the OIP. To get the definite name use this little script (Python): # Example obj must be selected hRec = vs.GetParametricRecord(vs.FSActLayer()) print (vs.GetName(hRec ))
  20. Hi Patrick, with these commands you should be able to do the job. They should be also available as Marionette nodes. Otherwise you can create them. http://developer.vectorworks.net/index.php/VS:Function_Reference CreateCustomObject(objectName, p, rotationAngle) SetCustomObjectPath(); The params can be modified with: GetParametricRecord SetRField
  21. Hi MTRobin, you could invoke the menu comand "Save copy as..." by http://developer.vectorworks.net/index.php/VS:DoMenuTextByName
  22. Hi, as I know there is no way to get Events with VectorScript so it will not be possible to trigger your PIO when a symbol changes. In the SDK you would create a class that inherits from VCOMImmediateImpl<IObjUpdateSupport> to catch global events. class UpdateSupportProvider : public VCOMImmediateImpl<IObjUpdateSupport> { public: UpdateSupportProvider(CallBackPtr); virtual ~UpdateSupportProvider(); // IObjUpdateSupport public: virtual void VCOM_CALLTYPE Init(IObjUpdateSupportContext* pContext); virtual void VCOM_CALLTYPE OnNotification(IObjUpdateSupportContext* pContext); virtual void VCOM_CALLTYPE OnState(IObjUpdateSupportContext* pContext, const ObjectState& state); ...
  23. Hello, maybe you simply forgaot the "namespace" try this: import random print ( random.randrange (0, 500, 3) )
  24. You could look if there es a selector to call the menu command: See:
  25. def vs.Poly(p): return None Poly is not returning tha handle 😉 Look for the function LastCreatedObj or similiar to get the handle. Edit: To slow. But one addition if you want to make sure that LNewObj is giving you the right obj you can first execute LNewObj save the handle then create the poly, do LNewObj again and check if the result is not the same as from the first call.
×
×
  • Create New...