Jump to content

Jayme McColgan

Member
  • Posts

    196
  • Joined

  • Last visited

Everything posted by Jayme McColgan

  1. ive been exploring using vs.TrackObject() but have run into a whole other issue of getting it to run more then once. it doesn't seem to play nicely with while loops in python. might need to bang my head against the wall some more with this.
  2. hey y'all! so i have a menu command plugin that allows me to click around in the drawing and place a custom object using vs.CreateCustomObjectN(), I'm trying to get this to behave like the Spotlight numbering tool where you can move around the drawing clicking on lights and it changes them to a red outline amd inserts some stuff based on the object i clicked on I'm trying to use vs.ReDraw() to display the newly inserted plugin object while i'm clicking around but that doesn't seem to be working.
  3. not really... the install file is how will be distributing all the custom plugins, workspaces, preferences, and such to the users in our company. the current process is painful... i need the ability to set all the preferences while installing all the plugins and workspaces.
  4. using VW 2022, vs.SetPref() in the install script seems to be crashing VW. i have removed everything from the install script except the SetPref stuff and it still crashes. when i remove all the SetPref lines it completes like normal. bug? known issue? vs.SetPref(49,False) #hidePageBoundary
  5. hmm using SetPref() might be a better idea. are there any other files that writes the file on close?
  6. i have a script that replaces the Vectorworks Preferences.xml file but when i go to restart VW22 for the new preferences to take effect it takes the current settings in the app and rewrites the file i jsut put in there. is there a way to "reload" the Vectorworks Preferences before closing it? the only way i can find to replace the existing file is to do it while VW is closed...
  7. solved it... you have to zip the files in the folder and not the root folder... *face palm*
  8. I'm trying to follow this guide on installing plugins and its just not working. I'm using VW 2022 on macos. https://developer.vectorworks.net/index.php/VS:Implementing_Installation_Script when i use the install button it uncompresses the zip file and puts the whole folder in the plugins folder and doesn't launch the install.py script or move any of the other files.
  9. vectors have been a voodoo that i haven't quite figured out yet but im trying... also, yes your graphic is correct. so i guess its back to banging my head against the wall trying to understand how to use vectors. lol
  10. now that i have time to work on this plugin again... ive found a solution for finding the distance between 2 objects using the Pythagorean Theorem... seems to be giving me good results... now i just need to figure out hte logic for if an object is to the left or right of the my source object... light_loc = vs.GetSymLoc(handle) ### Get 3D location of Lighting Fixture dis_a = sym_location[0] - light_loc[0] ### X Distance between Light and PIO Object dis_b = sym_location[1] - light_loc[1] ### Y Distance between Light and PIO Object distance = math.sqrt(dis_a ** 2 + dis_b ** 2) ### math...
  11. ill have to give this a try. ideally i want to store it in a json format in the field. i think i could be fine with 32767 characters. i could also have it delete older data as it fills up. ill report back with what i come up with.
  12. I'm looking for a way to store basically a log in one of my PIO objects. what is the max length of characters i can have in a hidden parameter? is there a better place to store it that would be linked to the PIO instance no matter what user/computer has the drawing open.
  13. I'm currently using VS code to do all my programming. i haven't really looked into remote debugging but it is on my long.... list to add to my workflow.
  14. @twk i seem to be getting some promising results with just using vs.Distance() i will check back with a progress update in a few days. I'm getting on a plane tomorrow to go to a show.
  15. sorry let me simply it. my issue doesn't really have to do with spotlight. the image attached is a representation of what i need to achieve. I'm trying to find distance from the blue object to the white object, then i will insert a plugin object that draws a line and other stuff that distance (represented by the red line). i drew the red line straight because i don't care about the vertical offset i only care about how far away (left or right) the objects is RELATIVE to the overall angle and location in the drawing. i hope that makes sense. this is hard for me to explain.
  16. HTHs the bottom truss is what the plugin actually looks likes. the other 2 trusses with red lines are in case its hard to see the bottom truss. the red lines are what I'm trying to calculate and automate.
  17. yo! so I'm exploring another side of VW scripting that ive hurts my brain... lol i've built a cable tool that makes Soca Breakouts. part of that plugin involves me putting in how far away the fixture is from my soca breakout and it inserts another cable tool plugin that draws a line between the two and displays some important information. thats working great but i want to automate that even more... i want to implement a feature that will find the distance between the fixture and breakout for me. i just don't understand the math or what functions i should be using to determine the distance. the truss and fixtures aren't always going to be the same orientation. below is an example of what I'm calling typical setups... i'm assuming that the truss, fixtures, and soca breakout are all in 1 line. (ill add curved truss support some day) so i don't really need to find the x,y,z distance between them i just need the left or right distance relative to the overall rotation and location of everything. i've tried using functions like GetSymLoc3D() but it seems to get messy quickly. i've also tried using vs.Perp() and got some good results but only flat angles. i also don't quite understand Math Vectors or how to properly use them. thanks for the help!
  18. thanks Pat. i also use AlrtDialog when i need to debug something. it wasn't being triggered when i put it in the light_collect function. maybe the plugin didn't recognize that it had something selected since it was selecting and running at in the same pass? who knows... ANYWAYS... moving the PON='Lighting Device' to the foreach seemed to do the trick. its seeing the lights now. thanks!
  19. hey guys, I'm working on a plugin that will behave similarly to the instrument summary but for power. part of that requires the plugin to find all the lighting devices in the drawing and gather information about that. i've done this a few times with menu command based plugins but i want to make it a point object to give a graphical interface like the instrument summary... below is the part of my script that deselects everything and then selects all my lighting devices, loops though them and collects some info about it. from what i can tell this just flat out doesn't work in a point object plugin... i've tested it in a menu command and works like a dream. it seems to select all the lights, NOT do the for each object, and then NOT deselect anything... i've also tried using a widget button (with event based turned on) to gather light info and that gives me some other weird results with not redrawing all the 2d elements like text and rectangles correctly. cur_lay_opt = vs.GetLayerOptions() vs.SetLayerOptions(5) vs.DSelectAll() vs.SelectObj("(PON='Lighting Device')") vs.ForEachObject(light_collect, '((VSEL=TRUE))') vs.DSelectAll() vs.SetLayerOptions(cur_lay_opt)
  20. Here is the Python Version! i also added a check so it doesn't go larger then the vertical box i want the text to be in. might a little messy but it works for my specific scenario thanks for the help @MullinRJ and @Pat Stanford max_size = 1 ### points (determed by trial and error lol) text_box_width = 2.8 ### inches string1 = "Super Long Fixture Name" vs.CreateText(str(f"{string1}")) last = vs.LNewObj() vs.SetTextJust(last, 1) vs.SetTextWidth(last, text_box_width) vs.HMove(last, 1.01, -0.2) textwidth = vs.GetTextWidth(last) vs.SetTextWrap(last, False) vs.SetObjectVariableBoolean(last, 684, False) textwidth_new = vs.GetTextWidth(last) sf = textwidth / textwidth_new for i in range(vs.GetTextLength(last)): ChSz = vs.GetTextSize(last, i) if ChSz * sf > max_size: vs.SetTextSize(last, i, 1, max_size) else: vs.SetTextSize(last, i, 1, ChSz * sf)
  21. Oh my... I've started doing some research into how pts compare to inches and they math hurts my head... Lol I've got a good working formula if all the characters are the same size but that's never gonna happen...
  22. lets say i make a text box that is 3" long but i want whatever text i type to dynamically size itself to always be on 1 line. using vs.SetTextSize() how would i go from deciding the point size based on the text length and the text box size.
  23. so whats else can i change in the "Edit Sheet Layer" Dialog box? can i go as deep as getting into the printer setup and creating custom page sizes? or changing the horizontal and vertical page amount?
  24. thanks @Jesse Cogswell heres the python version for anyone looking in the future. import vs width = 2 height = 3.4 sheet_num = "BM-1" name = "Test Sheet Layer" def make_custom_sheet_layer(): curlayer = vs.CreateLayer(sheet_num, 2) ### Create Sheet Layer vs.SetObjectVariableString(curlayer, 159, name) ### Set Sheet Layer Name vs.SetDrawingRect(width*12, height) ### Set Sheet Layer Size return None
  25. is it possible to set the sheet layer size to the viewport i have on it? i can't seem to find any VS Functions on how to change the sheet layer sizing.
×
×
  • Create New...