Jump to content


  • Posts

  • Joined

  • Last visited


7 Neutral

Personal Information

  • Homepage
  • Location
    United Kingdom

Recent Profile Visitors

778 profile views
  1. Resurrecting this topic, as I this has just answered my own question, though I think i've spotted a potential error Developer Preference Wiki page. Structural Mass units the Preference selector is listed as 9821, however from what I can tell it should actually be 6821. 9821 returns 0 every time, whereas 6821 returns the expected results. Not sure who to poke about this?
  2. Thanks Vlado, your suggested method worked great! Cheers Tom
  3. Hi Konstantin Sorry I should have Explained my issue a bit better, when I get a checkbox using the GetRField Command, I then have to compare it to the localized string for True. I do this using the below function: def check_locallised_bool(objectHandle,objectName,Field): localized_True_Bool = vs.EvalStr(vs.Handle(0), "1=1") # Gets Localised True Bool boolraw = vs.GetRField(objectHandle, objectName, Field) # Gets the Raw Bool result if boolraw == localized_True_Bool: # If raw string value is equal to localized version of True localbool = True else: # If raw string value is NOT equal to localized version of True localbool = False return localbool At the moment because in 2021, and according to the Developer page EvalStr returns a string so I am doing a string comparison, to compare the Result of the GetRField to the what I have established to being the String value for True in whatever Language the particular VW user is using. In 2022 EvalStr has started returning a Boolean rather than a string, meaning that a String comparison will always return False regardless. My question is whether this is an intended change or a bug? E.g Do I now need to change the logic to instead compare a Boolean result? Cheers Tom
  4. Hello All Some potential 2022 funkyness. I use the EvalStr function to get the localized string for "True" to then use this to compare to the results from Checkboxes using GetRField. (For more information on the method/reasoning see the below thread where @JBenghiatvery kindly showed me this method in the first place) Since migrating my plug ins to VW2022 I have noticed that EvalStr is now returning a boolean not a string, and thus causing all my comparisons to fail. localized_True_Bool = vs.EvalStr(vs.Handle(0), "1=1") # Gets Localised True Bool vs.AlrtDialog(str(type(localized_True_Bool))) I have tried the above test script in both 2021 and 2022. in 2021 it returns the Expected results of the String "True", however in 2022 it returns a Boolean of True. My questions are: A) Can anyone else replicate this and get the same results? B) Is this working as intended, or a bug? I can't see anything on the Function Reference suggesting that this has been changed in 2022, however maybe @Vlado or @K.Lalkovskimight be able to shed some light? Thanks in advance!
  5. Hello All I'm pretty sure I know the answer to this already... BUT is there anyway BuildResourceListN (or any of the similar BuildResource command) can access a VW drawing of an earlier version? (e.g Active Drawing is in 2022, and target drawing is 2021) Everytime I try this it just fails to import anything. Which I suppose makes sense, but I was hoping for the sake of cross version plug-in compatibility there may be a solution (other than the obvious convert the target drawing to the required version)? Thanks in Advance!
  6. Following on from this, a question about the actual plug in files themselves (VSM,VSO etc). Should these be backwards compatible with previous VW versions? Or do I need to distribute them in the oldest version I want to support and then when the user first runs the command it will automatically update it to the latest version?
  7. Thanks Josh, When you say the Data Folder do you mean /Plug-ins/Data or /Plug-ins/Common/Data? Given that vs.GetFolderPath() has an attribute for Common/Data but not /Data I should probably use the Common folder?
  8. So I was doing some bug hunting within one of my plug ins, and I seem to be getting some unexpected results from the vs.FindFileInPluginFolder() function. I'm using the function to retrieve the filepath for a file within my plug ins folder, which works absolutely fine. Where I'm running into problems is when I'm trying to handle a situation where said file does NOT exist... Below is the test code i'm using: import vs ok,path = vs.FindFileInPluginFolder('FileName.ini') if ok: # If File Exists vs.AlrtDialog("ok") else: # If File Does NOT Exist vs.AlrtDialog("no") The problem I seem to be running into is that the ok Boolean keeps returning True even when the file is definitely not present within the Plug Ins folder. First I thought it was still just cached in VW memory somewhere, so tried the old restarting VW trick. Same result. Eventually I noticed that I had another File called "FileName.vso" in the plug ins folder. a bit of experimentation later yielded these results: When FileName.ini is NOT present within Plug Ins Folder, but FileName.vso IS present: FindFileInPluginFolder('FileName.ini') Returns True FindFileInPluginFolder('RandomName.ini') Returns False FindFileInPluginFolder('FileName.randomfileextension') Returns True So from this it would suggest to me that FindFilePluginFolder command ignores file extensions and just looks for the File Name. Is this working as intended? The Function reference does say it searches for File Name, but then the example further down has an extension attached to it, and I believe it's fairly common practice within most filename/path related programming functions to take the extension into account? If this is working as intended does anyone have a nice workaround for dealing with same file names but different extensions. I was thinking I could probably do something with vs.GetFolderPath(-2) and some os.path commands... I realize the simplest solution is just to make sure every file has a unique name, which is probably what i'll end up doing, but thought i'd see if anyone has any helpful insights before I go digging through all my code for every reference to this particular file...
  9. I thought as much, are you aware of any handy guide or helpful threads that may point me in the right direction? (I can't say i've delved too far into the SDK yet)
  10. Thanks Yasen, that makes sense. Quick follow up question, is there a way (via Vectorscript) to add parameters to the Lighting Device Parameter worksheet?
  11. I have not seen the notes, do you have a link to them? I had a search on developer.vectorworks.com for them but it doesn't seem to return any results? I think what i've discovered is that using Circles as my testing object, was a poor choice, from what I can gather FindObjAtPt_Create will only return a circle object if the radius intersects with perimeter of said object. Luckily with both PIOs and Rectangles (which are the two main object types i'm interested in right now) the function does return any part of the object that is within the radius.
  12. Thanks Josh I've been having a play with FindObjAtPt_Create, and I'm struggling to understand how the radius parameters works. I've drawn a circle with a radius of 20000mm, and placed a number of objects within it and outside (see below image), however the results I'm getting are not as expected. If I set the functions radius to 20000 it still picks up objects slightly out of that radius, for instance the object with the red circle around it gets picked up even though the distance from centre (which is the location i'm selecting each time for the starting co ordinates) is 22608. Strangely even though it's picking up objects further away than the overall Circle, it's not picking the containing circle itself... Also from what I can tell I need to set the radius large enough to encompass the entire object for it to be included in the list. I've adapted the code from the example on the wiki as below: import vs def PickPointCallback(pt): startContainer = vs.Handle(); list = vs.FindObjAtPt_Create(startContainer, 1, 0, pt[0], pt[1], 20000) cnt = vs.FindObjAtPt_GetCount(list) vs.AlrtDialog("Initial Co ords: "+str(pt[0])+ ' '+str(pt[1])) for i in range(cnt): hObj = vs.FindObjAtPt_GetObj( list, i ) x2,y2 = vs.HCenter(hObj) d = vs.Distance(pt[0], pt[1], x2, y2) vs.AlrtDialog( 'Index: ' + str(i) + ' Obj Type: ' + str(vs.GetTypeN(hObj)) + ' Dist: '+str(d) ) vs.FindObjAtPt_Delete( list ) vs.GetPt( PickPointCallback )
  • Create New...