Jump to content

Gonda

Member
  • Posts

    52
  • Joined

  • Last visited

Everything posted by Gonda

  1. Hey All, So, does anyone know at what point an event enabled plug in pulls in the default values from parameters? I've tried altering these values during the InitXProperties event, but they seem to get overwritten. I've also tried doing it during the Reset event; however, this would then get called on a cut and paste resulting in any user-changed values being overwritten. I figured the easy way around this was to just add a test to the Reset event to see if it was the first time that it was called; however, in doing this, I've discovered that it seems that any global variables that get assigned get wiped as soon as handling of the current event is finished...is this accurate? Or am I just missing something? Cheers, -gonda
  2. Hey All, So, I think I know the answer to this, but is it possible to arbitrarily define a plug-in's Parameter ID's? Specfically, I have a bunch of parameters that are essentially processed (added, values set, etc) in a for loop and what hoping to essentially set the first group to 101,201,301 and the second group to 102,202,302, etc so that I can loop through the values using a single for loop with just adding an offset to access the relevant parameter... ...but I'm guessing this isn't possible...or am I wrong? Cheers, -gonda
  3. Hey All, Has anyone successfully gotten linting to work with VS.Code? I've been bashing my head against this for last couple of days and just can't seem to get it play nice... I've tried pointing the linter to the Plug-Ins directory, copying vs.py to the python library directory as well as placing it in the same directory that I'm using for my plug in and none seem to work.... Has anyone successfully gotten this to work?
  4. Hey All, So, I'm in the process of developing a custom PIO that has two parts. The first part acts as a standard object in terms of XYZ as well as movement, rotation, etc. The trick is that I'm also looking to have a second part to it that always displays information in the same place regardless of the XYZ of the point object. Example: Object is located at 5',-15'. In the OIP, there is an XY field to define where the secondary info appears, say 50',50'. Right now, all of the functions I've seen in the Function Reference seem to relate to the objects origin as opposed to the drawings origin. Is there a way to reference the drawings origin from within a PIO instead of the objects origin? Cheers, -gonda
  5. Hey All, With the addition of Python as a scripting language, it would be great to see the implementation of python console. Ideally, this would be an interactive console so you could try out small snippets of code but most importantly it would give the ability to use print() statements for both debugging as well as giving user feedback without having to resort to popping up an Alert-style dialog box. Cheers, -gonda
  6. Hey All, So, now that I'm in the process of attempting to use the python that was generated by Dialog Builder, I'm finding a few other issues. I'll summarize below in addition to my already mentioned post regarding semicolons: All instances of the true/false inbuilt constants are listed in all caps (i.e. TRUE, FALSE), which generates an error since the inbuilts in python are "True" and "False". Dialog Builder is trying to pass strings directly to the GetStr function instead of an integer. Since all GetStr does, is index a number to a string I can't think of a good reason not to just pass the hard integer values in this call: dialog = vs.CreateLayout( GetStr('dialog_title'), True, GetStr('ok_button'), GetStr('cancel_button') ) Cheers, -gonda
  7. Hey All, So, I've been working with Dialog Build for the last couple of days. Finally got my dialog finished and when I exported it, I noticed that Dialog Builder appended semicolons to the end of all the lines in the "#set alignments" section. Not that it matters functionally, but I figured for consistency this should get filed as a bug report. Cheers, -gonda
  8. Hey All, So, after doing a lot of digging through the absolute cluster which are line types/styles/dash style (it seems to vary depending on what function your looking but these seem to all be the same thing), I was wondering if there is a way to define a line type that uses World Units instead of page units. To this end are there actually two different types of 'line type' objects? When I imported any of the various ISO line types, I get a very different dialog as opposed to creating a new line type resource in the resource browser. Any one have thoughts on this? I'm almost wondering if I've stumbled across an incomplete area of the API... Cheers, -gonda
  9. Hey Raymond, So, maybe I'm missing something, but when I pasted your script into a command plug-in, I get units with both outputs. Am I missing something? -gonda
  10. Hey All, So, can anyone explain or point me somewhere that explains how Line Types currently work? As far as I can tell, line types are defined in page inches. How does this relate to document Units, Layer Scale, etc. Also, is there a way to have a line type that has a constant screen scale? i.e. The line type always shows up with the same level of of detail regardless of zoom level? It seems that this used to just work before they changed line type/style into resources. Cheers, -gonda
  11. Hey Raymond, Thanks for the info. This is basically what I'm looking for. I don't suppose there is a way to force it to print unit marks? I notice it does for Feet/Inches but seemingly it doesnt for metric units (i.e. mm, cm, m, km, etc) Cheers, -gonda
  12. Hey All, So, I'm looking to retrieve some fields from a custom PIO object and then drawing them as text in the document. I've defined the parameters as dimensions so that when the units of the document changes, units of said fields in the OIP change and you case use standard entering of numbers with units. What I'm getting stuck on if formatting these values. Whether I use PParametr_name or GetRField() to obtain these values, theyre always returned as a real number. Is their either a different function that I should be using to return the values as VW displays them in the OIP (i.e. 3'4", 54mm, 7.6m, etc) or is there an inbuilt function to convert the reals to display based on the documents current primary/secondary unit info or is this a function that I am going to need to build? Cheers all, -gonda
  13. Hey Josh, So, I found the MiniCAD Hooks file and it's a great reference. I've found all the info for the ObjXProp info; however, unless I'm missing something, I can't seem to find anywhere either in that file or elsewhere in the SDK files that lists the EventID Constants. Any other ideas? Cheers, -g
  14. Pat & MullinRJ: It is broken. If I set the text size, push and then pop, the text size should be what I set it at and this is not what is happening. Unless the PushAttrs() function is also clearing everything it pushes, it is not doing what the documentation indicates nor. JBenghiat: I'll look into that. It just seems that that is adding a lot more overhead and function calls since you're calling SetTextSize for every Text Block you create instead of just once. -g
  15. Unfortunately, I was actually doing a lot more than in the example I posted...I omitted a lot of things for readability. Hopefully this will get fixed in the next service pack. For now I'll have to settle for writing code that is hard to read and maintin Cheers, -gonda
  16. Hey Pat, So, I've done a little bit more digging and I think I've found the culprit. It seems there's an issue with the vs.PushAttrs() and vs.PopAttrs() functions. Ex: (This seems to work just fine) vs.PushAttrs() vs.TextSize(0.4) vs.CreateText("Test") vs.PopAttrs() Ex: (This fails) vs.TextSize(0.4) vs.PushAttrs() vs.PopAttrs() vs.CreateText("test") I'm guessing as part of the Push/Pop functions, there's either an integer cast or rounding happening which is why anything less than 0.5 seems to fail. Cheers, -gonda
  17. Hey All, So, I don't know if anyone has done a lot of drawing of text through python, but I think I've either found a bug or am completely misunderstanding how to vs.TextSize works. I realize that text size changes relative to Layer Scale. In my script have defined a scale factor to take this into account. The problem that I seem to be running into, is that when the drawing is set to Millimeters for units, the smallest that I get the vs.TextSize function to draw is 1. When I set the font size to less than 1, the text doesn't draw at all. Now if I just drop a text object into the drawing, I can seemingly set the Font Size down to at least 0.01 Point via the OIP pulldown. I may be wrong, but it appears as if the vs.TextSize function, even though it says it accepts non-integer values, appears as if it is applying a rounding function to the input before passing it to the actual drawing routine within VW. Has anyone encountered this before or am I just overlooking something that is completely obvious? Cheers, -gonda
  18. Hey All, So, I'm working on implementing a Custom Object in python that I want to have Events enabled for. I understand the I need to use vsoGetEventInfo function to get the Event ID and any related info (Control ID, Button ID, etc)...my question is, if there a list somewhere of all of the possible Event ID Integers and descriptions of what each of them are? I've tried looking through the dev documentation and I've found a few scattered here and there in various examples but I have been unable to find a comprehensive list. Does anyone either know where one of these is or has a list that they can post? Cheers, -gonda
  19. Thanks for the info Josh...I figured there was something like this...unfortunately, the class vs.HandleContainer doesn't seem to have a Handle (or HANDLE) method and all the permutations I've tried of vs.NIL generate undefined errors... I don't suppose you know of a documentation source that describe the internal object classes and there supported methods/variables? Cheers, -gonda
  20. Hi All, So, I've been working on a script that uses vs.NextObj to iterate through a list of objects. I know that when it gets to the end of the list, according to the function reference, it will return NIL. The problem I'm running into is what exactly 'NIL' is and how to test for it. Canonically, testing for existence in Python uses: "if foo is None"...I've tried testing the returned handle again pretty much everything I can think of (0, 1, NIL, nil, Nil, False) and all of them fail...I did discover that if you try to type() the returned handle, it comes back as a member of class vs.Handle...is there a method of this class to test for existence? Cheers, -gonda
  21. Hi All, Is it possible to remove/delete items from a Layout? i.e. Pressing an "Add" button adds a text entry box and pressing "Remove" deletes a text entry box. I've found plenty of functions for creating, moving, editing, etc, but none for deleting which seems odd. My issue is that I need to create a Layout/Dialog that is dynamically generated so prearranging everything and just showing/hiding items will not work. Cheers, -gonda
  22. Hi All, So, maybe I'm missing something obvious, but I can't seem to find a way to create a selective group via Scripting. Example: There are 3 objects selected. Based on some processing, I want to create a group containing 2 of these objects. Group() will create a new group, but it only works on all of the selected objects. The BeginGroup() function can do selective grouping; however, as far as I can tell, it can only handle creating a group based on newly created objects. Anyone have any thoughts or am I just missing something completely obvious? Thanks, -g
  23. Hi All, So, when working with Python scripts, is there any way to access current states of things? Specifically, I'm working on a tool that will take multiple selected objects, read information from them, compute and then modify the objects. What I'm running into is that it seems that most functions want a handle to an object to do anything useful...I've found I can use a custom selection via criteria; however, I can't find a way to get from a selection based on criteria to object handles. In a perfect world there would be some object or method (ie vs.CurrentSelection(). ) that would return either a single object handle or a list of multiple object handles...any thoughts and/or am I missing something obvious? Thanks, Jon Gonda
  24. I can, but it still seems that I would need a different _main.py for each script/command I would want since I would have to alter _main.py for each. I could do the dialog thing, but I was really hoping to be able to build a bunch of scripts that could be activated via key commands... Guess I'll just have to get back to trying some way to hack around the system... Thanks
  25. I could be misunderstanding the sample, but it sounds like the plug-in is locked in to running only a file called '_main.py' and since it says to just dump it in the Plug-in's folder, this effectively means that there can only be one copy of it so it wouldn't really work for managing multiple added commands. I figured there would be an easy solution to this since VW seems to already be able to run scripts located anywhere on the HD from the 'Run Script...' command.... -g
×
×
  • Create New...