Jump to content

Juliensv

Member
  • Posts

    33
  • Joined

  • Last visited

Reputation

24 Great

Personal Information

  • Location
    United States

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  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?
×
×
  • Create New...