Jump to content

Juliensv

Member
  • Posts

    33
  • Joined

  • Last visited

Everything posted by Juliensv

  1. I think maybe you need to have the new PIO delete the old PIO. When you instantiate the new PIO, you can have the old PIO insert its own handle into a hidden parameter of the new PIO, then reset the new PIO. The new PIO could check this parameter every time it's reset and do nothing if blank but delete the handle when there is a handle in the parameter. Hopefully that makes sense?
  2. I haven't found a way to use any other associations than DeleteDelete and Delete Reset. If your owner object is your own custom object, you can do the association yourself by having the owner object reset the target object with ResetObj, and by setting the option to reset on move.
  3. Hey y'all, I'm trying to get the length of an existing dimension, but I'm not sure how to go about it. I can get the "text" of the dimension with GetDimText but it's rounded to the dimension precision, and it's also a string which I need to parse to get the actual value. I'd like to get a REAL in the document unit precision. I've tried multiple methods, Hlength, HPerim, , which haven't garnered good results. The closest I can get is using Get2DPt, which works with aligned dimensions, but it's complicated with Linear Dimensions that have different offsets on each witness line, because Get2DPt only gives the location of the end of each witness line. I've tried screwing around with the witness line override selectors but that doesn't change the Get2DPt. Dimension Offset selector 45 only gives the length of the "first" witness line, so there's nothing to compare to figure out the orientation/offset of a constrained linear dim. Do y'all have any ideas how to get this? I'm sure I'm missing an obvious answer. Thanks in advance!
  4. @ge25yak To add on, ForEachObject passes the handle of each object that matches the criteria, one at a time to a callback function, which means you have to set up a global list to extract just the handles. Example: handles = [] def callback(h): global handles handles.append(h) vs.ForEachObject(criteria, callback)
  5. Hi Steven, I've never used BuildResourceList before, but another way you might go about this is to get all the symbols in the file in a list, then discriminate between them using GetParent, which should return the folder that symbol def is in.
  6. Okay, I've solved my problem, but this is really strange... So I've been doing a little troubleshooting, and it seems like the module "urllib" does get loaded in both Marionette and Plugins/Scripts, but the problem is that urllib doesn't contain any functions in itself, it contains submodules, which are where the problem lies. The submodules do not get loaded in with the import statement in either scripts or plug-ins. Weirdly, they do get loaded in inside Marionette nodes, which is why I had the inconsistent behaviour. The simple way to get around it is to directly import the submodule. In my case: from urllib import parse url = parse.quote(body, safe="") It's just really strange that it behaves this way, and I wonder if anybody more Python knowledgeable knows why. It seems like a bug. If you're interested, here are the relevant results of using inspect.getmembers on the imported modules, they are identical, other than just not including the submodules: in a script or plugin there are no submodules: In a marionette node there are the correct submodules:
  7. Hey y'all, I am trying to use the urllib standard python library to parse a string to make it safe to put in a URL. This works in a custom Marionette node I made before, except I had to put the imports inside runNode() for it to work properly. It is not working at all in the plug-in command or the plug-in object I'm trying to integrate the code snippet into. I get " AttributeError: module 'urllib' has no attribute 'parse' " whenever I run the plug-in. I checked, and everything's running on Python 3.9. I don't understand why it would work inside a marionette node and not inside a plugin when other libraries are working fine. Here is essentially what the code snippet looks like. Does anybody have any idea what the problem could be? import urllib import webbrowser run(): #do some stuff url = urllib.parse.quote(body, safe="") webbrowser.open(url)
  8. As far as I know, there is no good way to do any real user interactive stuff in Python, other than dialogue boxes. It's been explained that the way python is implemented it doesn't wait for user input.
  9. I want to bump this because I encounter this issue fairly often as well. It is annoyingly inconsistent, but extremely frustrating.
  10. You may also want to use the "Crop Visible" option for the viewport, so that you don't have to draw a separate polyline.
  11. @E|FAThe error message seems pretty clear? "A parametric object named "Callout" has failed because Class Definition with that name already exists within the document" To me, it is pretty clear that you both can't coexist in the same document, so you have to have one or the other.
  12. Wow, I can't believe I missed that. I think I just glossed over it because of the name. Thank you!
  13. Hey y'all, I am writing plug-ins that are used in project sharing files, and I'm having difficulty managing project sharing-specific features. I have been trying to use the "(OWN = "#")" criterion to find out whether an object is checked out to the active user or not. It seems, however that this criterion only considers objects which have been directly checked out individually, and ignores objects on checked out layers. These objects should technically be "owned" by the active user, but not according to the OWN criterion apparently. To workaround this I was trying to figure out how to find whether a layer has been checked out, but I seem to have hit a wall. It doesn't seem like I can use vs.Eval with the OWN criteria on layers. Does anybody know any other way to figure this out? Thanks in advance.
  14. To answer this part of the question, usually this means the x/y is presented to the function as a tuple, like (x,y). A tuple in python basically just an immutable list of values, that can be passed into a function as a variable just like a list or integer of anything. So your code would look something like this: symbolName = "mySymbol" p = (x,y) rotationangle = 180 vs.Symbol(symbolName, p, rotationAngle
  15. Does this delete or disassociate any worksheet images or does the association stay after you've deleted and recreated the worksheet?
  16. The Vectorworks script editor is very limited and as far as I can tell, does not offer the functionality to insert spaces rather than tabs in your code. It shouldn't be a problem because the python interpreter parses either one, as long you're consistently using only tabs or consistently using only spaces. This is annoying when you're copying code from other sources, but your only alternative is to use another code editor.
  17. Hello All, I have a PIO which pulls data from title block project data as well as the sheet number and sheet title. I'm wondering if there's any way to make the PIO reset whenever I change this data. It is event-enabled. Thanks!
  18. If you're looking for a drop-in function, here is my usual workhorse interpretation in Python. def getSelectedObjs(*typeFilter): listObjs = [] layer = vs.FLayer() while layer: handle = vs.FSObject(layer) while handle: if typeFilter: if vs.GetTypeN(handle) in typeFilter: listObjs.append(handle) else: listObjs.append(handle) handle = vs.NextSObj(handle) layer = vs.NextLayer(layer) return listObjs I'm sure you can accomplish something similar in Vectorscript, even given it's seeming hatred for anything to do with dynarrays
  19. Uh Wassup Alex 😅 Are any of your symbols or component symbols named or classed the exact same as the layer you want to set them to? There's a bug with the command that Node uses to get the layers, that means it will miss a given layer if there are any classes, resources or named objects with that name. If that's not the issue, you may also try grouping all the objects, setting the layer to that group, then ungrouping.
  20. Interesting, my office has been using project sharing as the norm for about a year and a half now, and we have a couple marionette objects that have been working just fine throughout that. I have noticed the slow "first reset" when copying a marionette object to a new project file as willofmaine pointed out, but after that reset, and after committing, any other users see and can interact with the object just fine. Mostly, our marionette objects have already been baked into the template file we all use to create our master files, so that may have mitigated any potential issues.
  21. This is perfect! I didn't realize that HPerim on an arc would give the arc length. But it does make sense now that I think about it. It's funny because I was actually trying to find the arc length of the arc in the first place... Anyways thank you for the help, as well as the tip on looking in the Marionette Nodes!
  22. Hello all, This feels really simple, and I'm a bit embarrassed to ask the question, but how does one find the radius of an arc object? vs.GetArc gives me startAngle and sweepAngle, and vs.HCenter will give me the centerpoint of the arc, but then how do I get a point on the actual arc to measure, without using PtOnArc or something ugly along those lines? Thank you for your help!
  23. For the second one, you're not making use of the crazy features built into Python to write really compact code! Namely, you can use a list comprehension to get just your second list without the omitted items, or you can just simply use the "in" test while looping through the items in your second list! omitList =['name2', 'name3', 'name4'] listToFilter = ['name1', 'name2', 'name3', 'name4', 'name5'] #either use a list comprehension to get the filtered list filteredList = [name for name in listToFilter if name not in omitList] # or step through the list and use "in" to test each name for name in listToFilter: if name in omitList: continue #rest of your function
  24. Hi Pat, The NURBS surface is just a slice from a cylinder, so I believe it should be "developable". I think really what I'm confused about is why it would behave differently with a reversed surface normal.
  25. Hello, I have a NURBS surface which is made from a half-cylinder and then trimmed. I use the Unfold surface command but the shape it spit out is a little strange. One side seems correct, but the other side has kind af a bulbous shape which does not correspond to the NURBS surface at all! The strange thing is that when I reversed the surface normal, the unfolded shape created looks correct. This is in VW2023 SP3 I have included both results in the file as well as the two shapes super-imposed. Any idea why the command is behaving this way? Is it a bug or something I did? Unfold surface troubleshooting.vwx
×
×
  • Create New...