Jump to content

AlHanson

Member
  • Posts

    86
  • Joined

  • Last visited

Everything posted by AlHanson

  1. Sorry for the long delay but I haven't been able to dig into this for a while. This is very helpful @MullinRJ, but I'm still struggling with some looping issues. I *think* I've finally narrowed down the problem to the plug in implementation I was using while playing around. I've been playing with as a Point Object Plug In, but with this option I can go through the process of displaying the pop up, selecting from the pulldown and ok'ing the selection and everything works as intended, however it will then retrigger event 12255 and start the process all over again, including when switching over to the modified code that you've provided. If I import the script into a simple menu command script, it all functions perfectly as intended and inserts the selected symbol without issue. So in part, the struggle here is likely my sequence of events if I am to build this as an insert point object... I'll have to dive into that more since this initial pass was really just experimentation to get used to the dialog building rather than creating something specific. Insights on the loop issue would be helpful if anybody has some better understanding of this or can suggest the better approach to using a dialog like this in a point insert object.
  2. I'm working with my first custom dialog display, and all the new stuff is clicking into place just fine, but I'm struggling to figure out the best ways of processing the interaction and not having any luck finding examples or details. Here's the example I've been playing with (might be a few oddities in the code lingering from some of the different approached I've been experimenting with). Right now this is attached to a point insert custom tool, and I'm just experimenting to get an understanding of the flow here- All I'm currently doing is building a simple popup that will show the symbols from another resource file and insert the selected symbol into the custom object. I've got Alerts tied to the dialog handler so I can see all the events that get passed around while I'm figuring this out. Where I'm struggling, is on the symbol insertion step. I'm logging the selection event just fine and getting the resource index from the Thumbnail Popup, and off this event setting a variable to the selected index, under the assumption that then when I click 'OK' it will register the 'OK' press, check that the iSymbol variable has been set and then insert it. However getting this variable passed around is proving problematic. I've tried declaring the variable both inside and outside Dialog_Handler, each have issues and I'm frequently being told iSymbol is getting referenced before assignment. The only way I'm able to make this 'work' is to build the symbol insertion in to the selection in the pulldown but that seems messy and can insert symbols without confirming anything. This also is causing me some looping issues that I'm not clear on the cause. After confirming the symbol, the SetupDialogC event is flagged again. Not sure what that's about... Also, I'm getting an item passed into the data handler as -12613. I dug around and checked the usual places, searches and the MiniCadCallBacks.h file and I can't find anything about what this flag represents. Any ideas? So clearly I'm still not quite getting the full process down, any easy fixes here or examples that can clear up some of the messiness I'm encountering? import vs debugMode = True btnOK = 1 btnCancel = 2 kThumbnailPopup = 101 SetupDialogC = 12255 iSymbol = -1 #bSymbol = False def Dialog_Handler(item, data): #global iSymbol if debugMode: text = 'Running Dialog Handler. Values Returned:\r\ritem: ' + str(item) + ' | data: ' + str(data) vs.AlertCritical('DIALOG HANDLER', text) resourceType = 16 fullPath = "../Libraries/Objects - Building Equip_Appliances/_Office Equipment.vwx" (symList, numItems) = vs.BuildResourceListN(resourceType, fullPath) # (symList, numItems) = vs.BuildResourceList2(resourceType, 0, '', False) if item == SetupDialogC: for i in range(numItems): name = vs.GetNameFromResourceList(symList, i) #if name[:7] == 'zNested': # continue vs.InsertImagePopupResource(dialog, kThumbnailPopup, symList, i) if item == kThumbnailPopup: # Interaction with Pulldown Menu #bSymbol = True iSymbol = data hSymbol = vs.ImportResourceToCurrentFile(symList, iSymbol) vs.Symbol(vs.GetName(hSymbol), (0, 0), 0) if debugMode: vs.AlertCritical('Clicked something in popup, setting iSymbol to: ', str(iSymbol)) #if item == btnOK and bSymbol: # OK Button Pressed and symbol has been selected #hSymbol = vs.ImportResourceToCurrentFile(symList, iSymbol) #vs.Symbol(vs.GetName(hSymbol), (0, 0), 0) #if debugMode: #vs.AlertCritical('OK BUTTON!', 'iSymbol: ' + str(iSymbol)) def CreateSampleDialog(): global dialog iSymbol = None dialog = vs.CreateLayout('Add Choice Sample', 1, 'OK', 'Cancel') vs.CreateThumbnailPopup(dialog, kThumbnailPopup) vs.SetFirstLayoutItem(dialog, kThumbnailPopup) vs.RunLayoutDialog(dialog, Dialog_Handler) vs.SetPref(412, True) CreateSampleDialog()
  3. Still slowly working through things and haven't gotten into the event based stuff yet, but DEFINITELY spending some time playing with this example. Great to see this, I was just thinking about starting to make similar simple example projects to help the community and this is a great reference. Here's a few things I have found so far: -Incorrectly placed control points just seems to be a refresh bug. I've found that creating the control point the in the definition and then later changing it as I'm updating what the defaults should be as my script evolves doesn't take internally. It'll show the new default value but it's still holding the initial default value and sending that into the script. The only way I've been able to deal with this so far is to delete the control point in the definition, exit the plug in manager, (let the script spaz out with errors), and then go back into the plug in manager and create new control points with the corrected values. It's obnoxious but it's simple enough for a couple points since it auto names everything anyway. -Hiding the control points definitely seems to be an event based function because I initially just built the hide portion into and ELSE statement, but when the conditions changed to true it wouldn't come back until I also built the make visible line into the the initial IF portion of the script. Interestingly though, there doesn't seem to be any need to check the Event Based execution in the definition options. Haven't dug into this any further since it's working just fine for my current needs, perhaps there's some distinction here that will become more obvious as I dig into the event based code more.
  4. Excellent, thanks for all the fantastic info @Jesse Cogswell! Lots to dig through here, will take me some time to explore and definitely keep me busy this weekend! The function reference has definitely been my friend lately and has it's own dedicated screen at this point, but knowing what to look for is 90% of the battle- especially when can't just search for a clear term and have to guess on some abbreviations like 'CntrlPt' because searching for 'Control' doesn't help. Also, was not aware of the Script Reference HTML and it looks to be another great resource. I had previously steered clear of the VSO and Event Based stuff as I thought I saw in some post that these were really only available to C++ but looks like I'll need to spend some time reading and exploring this more.
  5. Working on figuring out plug-in tools via Python scripting and have a few questions: -How can I add a separator line to the OIP? Also a slider? Interesting how these are present in Marionette but no direct easy access in the Plug In Manager. -I'm having trouble with the default values on my control points- The defaults are set to values such as (0,30"), however when I insert the object all control points default to (0,0). Nothing in my script is directly updating these values, and they respond to being moved just fine after inserted. -I have a text object that is inserted at a control point, and a Boolean that toggles whether or not the text is displayed- how can I make this also get rid of the control point? -How can I use the Text controls in the menu to adjust the text settings in my object?
  6. Found it while looking at other things: vs.SetSymbolOptionsN A little frustrating that all these options in one spot are adjusted so differently, but at least it's there. Hope this helps somebody else down the line!
  7. Thanks! Basically what I assumed, just hoping to force to process and not have to drag it out with a manual step but it is what it is.
  8. Looking for some insight on setting the 'Assign to Class' options of a symbol via Vectorscript so I can set this as my script imports some mesh objects. The Symbol options dialog seems to present a lot more info than the appendix covers for Symbol options. vs.SetObjectVariableBoolean is the only thing that appears to edit this setting at the value of 128, but its just a bool that is either <Active Class> on False or True when any other class is selected. I've hammered the variable types and ranges in script and can't seem to track this down, if it's actually accessible. This isn't that big of a deal if I can't make it happen on the import, but I figured it's worth looking into before I start importing everything.
  9. I'm working on an import script for a lot of mesh objects, and would like to simplify them as they come in as some are unnecessarily complex. Is there any way to automate this with vectorscript that I'm not seeing in the function reference? I'm even open to manual ways of accomplishing this is anybody has some insight. I attempted to just delete random mesh vertexes over x quantity and this proved to be a terrible idea since the mesh can't just patch back in the missing polys this caused. 😆
  10. If anybody winds up here down the line, I finally figured this out. The command is vs.GetTextureRef/vs.GetTextureRefN. This was one of the first things I was trying, however everything I was testing on was a Mesh object, in which case you cannot use Overall for the part number. As I'm finding now, meshes us Part ID 4 ('Top of Extrude or Sweep'). Once I stumbled on that everything started working just dandy. Hope that helps somebody down the line!
  11. Looking for some help getting remote debugging through PyCharm Pro to work if anybody has experience. As far as I can tell I'm doing everything as needed, but it's just not coming together. I've followed guides as well from PyCharm Remote Debugging and Vectorworks Python Debugging and got some great info from this old post from @MeTheMachine. When I get to the final steps and actually run a script in Vectorworks for the debugger I get an error on the PyCharm side: I'm not sure what the problem is here. All software is current and downloaded today from PyCharm to the pydevd-pycharm library. I've tried to copy the pycharm-debugger.egg file the error says to use into my project environment but I'm either not putting it in the right place or I'm missing something in importing or referencing it in the script. I also attempted to follow the pip command which installs the version it wants, but I still get this error. Anybody have any insights on this issue or recommendations on alternative methods for debugging python scripts with Vectorworks?
  12. @Yasen Aleksiev Thanks for the correction and clarification to make this work. Very helpful!
  13. Perfect! I didn't realize that information was just hanging out in such an easily accessible place... Was hoping they had made this a built in function already to do this more simply, but clearly not. Your information was perfect! I was able to whip this together in no time. Thank you much! My only tangential question then would be which is more practical? Running the file read code every time it needs to look up the data or simply including a dictionary put together from all this data. The files make more sense in terms of always getting the most current data (but how much are the gel libraries really changing these days?) but this is more code to run through on each run (which is still not very many lines). Ultimately I'm sure it makes no noticeable difference whichever route is used as it's all instantaneous and file sizes are miniscule. Just curiously pondering- I'm still fairly green at coding (I wrote the entire thing in python with the exception of the vs.FindFileInPluginFolder command you suggested).
  14. I notice there's some new vs commands to get Lighting Device information in 2021 and am trying to decipher the specific details for these: VS:LDevice_GetParamBool - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamBool VS:LDevice_GetParamLong - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamLong VS:LDevice_GetParamReal - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamReal VS:LDevice_GetParamStr - https://developer.vectorworks.net/index.php/VS:LDevice_GetParamStr I've been able to get MOST of the data in the record working after some digging through the worksheet to get correct names on some of the more oddball parameters, but for some reason I'm not able to get a few of these fields to return anything on any of the commands, and they're mostly simple fields that I wouldn't have expected to have issues with: Device Type Instrument Type (Inst Type) Fixture Mode GDTF Fixture Mode GDTF Fixture Wattage Purpose DMX Footprint (Num Channels) Time Cost Frame Size Weight Symbol Name Anybody else have any luck with these or some other insight?
  15. AlHanson

    rotate list

    There's a "Reverse List" node that you can attach between your point list and the 3D poly node that should give you what you're looking for.
  16. Is there any way to get colors from the existing color libraries in Vectorworks via vectorscript- particularly for spotlight gel colors? Clearly it's there as the Color field on a lighting device can access the color libraries this way, but there doesn't seem to be a function that I can track down which gives a similar functionality. I've already previously built my own custom dictionary with gel names and RGB values that works great for what I'm doing, but it really seems like I shouldn't have to go this route of loading in hundreds of values manually when the information already exists in the program. Any thoughts?
  17. There is a non-Marionette work around to this, but it's still going to require some configuration: 1) Modify/Create the fixture texture so that instead of being a black color, the color shader is set to use the Object Attribute 2) Modify the symbol geometry fill color to be white instead of black 3) Go into Spotlight preferences and check Modify Lighting Device Color using Object Attribute 4) Change the fill color on the fixtures and it'll take it! Can probably go some steps further if you want to leave the 2D normal and only change the 3D by changing the classes of the fixture as needed and using the 'Modify Only Geometry in the Class' setting in the Spotlight preferences as well.
  18. What's the end goal? There might be a better way of approaching this as you can change colors in other ways depending on the stage of your process and need. As far as I'm aware you won't be able to do this if you expect the lighting fixture to work as a normal spotlight fixture plug-in object, so if you're expecting that level of interaction with the object then the answer is more than likely no. If you're just trying to create a visual prop for renders this is very doable as a marionette object.
  19. Has anybody had any luck scaling Meshes? I'm really struggling to make this happen correctly on the Z plane. I've tried a bunch of different things with the results being middling at best. 1: Scale Node By design the existing Scale node will not recognize a Mesh as a 3D object. It is check for type values 24 (Extrude), 84 (CSG Solid), or 113 (NURBS Surface), therefor the object is assumed to be 2D and will only scale on the XY axis out of the box. I've also attempted grouping the mesh first prior to scaling as i found this to solve some wrapper issues I had with the scaling node on previous projects, but this doesnt help either. 2: Scale Node Modified Attempting to add mesh as an option by modifying the node to include t == 40 still doesn't work. Mesh is only scaled on the XY axis. Going even further on the modification to this node and stripping it of all conditions and forcing the handle straight into the vs.HScale3D vectorscript command still will only scale on the XY axis for me. 3: Set 3D Info Just doesn't seem to work with meshes at all as far as I can tell? 4: Setting the Mesh Vertex Partial success here.... By getting the list of all the vertex points in the mesh and giving them new coordinates that were doubled values works... sort of. It will function just fine for a smaller simpler example like shown here, but is slow and very often breaks in weird ways when I attempt it with substantially more detailed mesh objects I'm importing (around 30-50k polys). 5: Scaling Rotating Scaling and Rotating... What finally seems to be the best solution is obnoxiously more involved and just copes with only being able to scale on the XY axis. Scale once for the XY, rotate 90 on X, Scale again for Y, then rotate back. It's getting the job done but this is way steps and code than should be required to do this... Anybody have any thoughts or observations on this matter? Am I missing something here, or is the scale function just broken in script?
  20. Version 1.0.0

    29 downloads

    Very simple math nodes that cover frequently used math in networks. Mostly just to keep things cleaner with fewer nodes. Think Add 1 and Sub 1. Half - Divides by 2 Double - Multiplies by 2 Squared - Value to the power of 2 Cubed - Value to the power of 3
  21. Version 1.0.0

    32 downloads

    Produces text that justifies and resizes itself to fit within the bounds of a provided rectangular object.
  22. Version 1.0.0

    16 downloads

    Restricts the output value to the minimum and maximum ranges provided
  23. Version 1.0.0

    16 downloads

    Nodes to convert color temperature in Kelvin (K) values to RGB
  24. Version 1.0.0

    9 downloads

    A set of nodes that converts between RGB and HSV colors and allows for adjusting RGB colors by HSV Values using the Python Colorsys library
  25. Version 1.0.0

    25 downloads

    Calculates the required font size to produce text of the desired height.
×
×
  • Create New...