Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

161 Spectacular


About MullinRJ

  • Rank
    1000 Club

Personal Information

  • Occupation
    Circuit Board Designer
  • Location
    Dallas, TX

Recent Profile Visitors

1,734 profile views
  1. @Wizard12 , This may be overly simplistic, but you can check the existence of a name without building a list with: NameExists := GetObject('Your test name here') <> nil; or if you want to also test if it is a Symbol, then: H := GetObject('Your test name here'); if (H <> nil) then begin if (GetTypeN(H) = 16) then begin { name exists and it's a Symbol } end else begin { name exists and it's NOT a Symbol } end end else begin { Name does not exist } end; HTH, Raymond
  2. Hi Pat, You forgot option 4. ...` 4. Everything you observed is spot on; it didn't always work this way; and you are losing your memory. which is consistent with programming too long and .... losing your memory. : p I am having similar occurrences to what you and Julian observe while editing a PIO I am currently developing. For the most part, making changes to the PIO code does not create any wrinkles, but edits to the parameter list, either adding or subtracting (and possibly reordering) parameters, results in very odd behavior – like all of my OIP buttons failing to display, and / or ControlPoint fields that I've explicitly hidden now show up. I have not been able make the PIO rectify itself, so I restart VW without even trying to cajole it to behave. I've not tried what Josh suggests, but I will when I edit my parameters again and if I get a favorable result I'll post back. Raymond PS - If you do file a bug, I'll vote it up.
  3. Larry, The code you wrote from scratch is not beeping, but you call two built-in PIO's at the end of your script and access their "Size" parameters (as shown in the OIP) using "size" as the parameter name. This is the wrong parameter name. When you access a parameter from a PIO, VS always uses the name in the left hand column of he Plug-In Manager, but the OIP always displays the name from the Alternate Name column when it exists. This can be confusing if the names are the same as they are in this case. The "Size" parameter from the OIP which in this case is the Alternate Name for the parameter, belongs to "size_1", which is the actual parameter name for both Built-In PIO's. To access the "Size" parameter in both of these PIO, you need to use the "size_1" parameter name. It is parameter #2 in the Plain Washer (Inch) PIO, where you are accessing parameter #7 "size". In the Nut (Inch) PIO, the "Size" parameter is again #2, "size_1", where you are accessing parameter #22 "size". The real clue comes when you look at both parameter lists using the Plug-In Editor and the alternate name for both parameters named "size" is "__NNA_DO_NOT_CHANGE". I don't know if you opened either of these plugins in the Plug-In Manager, but if you haven't, do so. This description may make a lot more sense. Bottom line – you are accessing parameters in Built-In Plugins that should not be changed; hence the beep. HTH, Raymond
  4. Hi Michael, Any way that works is a good way. But if you have TextWrangler, or BBEdit, you can paste the formula in a file and when you double click on a parenthesis (left or right) the program will highlight all text between it and its matching parenthesis. Extra and missing parentheses are very easy to spot this way. Very handy tool for just such occasions. Raymond
  5. @Digbaddy , After you get lost in Michael's anatomically perfect answer, there are some ways to reduct the length of the overall expression. Since your expression evaluates a series of stair step conditions, you don't need to test both sides of each step every time. You only need to evaluate the AREA as it crosses over each threshold value, as such: =if(AREA>=1500, AREA*0.45, if(AREA>=900, AREA*0.4, if(AREA>=600, AREA*0.3, if(AREA>=450, AREA*0.2, if(AREA>=300, AREA*0.15, if(AREA>=200, AREA*0.1, 0)))))) Additionally, you can factor out the AREA* term from each nesting of the compound IF and only return the scale factor for each AREA range, which you then multiply with the AREA outside the IF construct, like this: =AREA * if(AREA>=1500, 0.45, if(AREA>=900, 0.4, if(AREA>=600, 0.3, if(AREA>=450, 0.2, if(AREA>=300, 0.15, if(AREA>=200, 0.1, 0)))))) But, if you are really picky (like someone I won't mention) about minute details, you can replace each >= operator with a < operator by reversing the logic, like this: =AREA * if(AREA<200, 0, if(AREA<300, 0.1, if(AREA<450, 0.15, if(AREA<600, 0.2, if(AREA<900, 0.3, if(AREA<1500, 0.4, 0.45)))))) The character count for each IF expression is as follows: 254 (Michael's answer), 155 (my 1st answer), 132 (my 2nd answer), 126 (my last answer). They all evaluate essentially the same, but the shorter expressions are easier to read and modify. The only difference between Michael's answer and mine, is that I return "0" for areas < 200, and Michael returns a "-" character for that condition. Take your pick how you want to handle that condition. HTH, Raymond
  6. @Sam Jones , There are a lot of "ResList_" calls that I've never used, so I don't know if you cay build One List to rule them all, but I will say that the way you don't want to go really isn't that hard to implement, and once built, it stays perfectly registered between Symbol Name and Source List. Also, extending this approach to handle several lists would be quite easy. Here's a very quick sketch of how it could look. Of course, it's not tested. I wouldn't want to deprive you of all the fun. 😉 It assumes you won't have duplicate symbol names. Hopefully you don't, but if you do, one entry will point to list 1 and the other will point to list 2. If you want to specify your directories by absolute path, use BuildResourceListN() instead. Type SymNameRec = Structure SName :Dynarray of Char; LID :Longint; end; { SymNameRec } Var I, NumItems1, NumItems2 :Integer; ListID1, ListID2 :Longint; SymArray :Dynarray of SymNameRec; BEGIN ListID1 := BuildResourceList(16, <folderIndexA>, <subFolderNameA>, NumItems1); ListID2 := BuildResourceList(16, <folderIndexB>, <subFolderNameB>, NumItems2); Allocate SymbolArray [1..NumItems1+NumItems2]; for I := 1 to NumItems1 do begin SymArray[I].SName := GetActualNameFromResourceList(ListID1, I); SymbolArray[I].LID := ListID1; end; { for } for I := NumItems1+1 to NumItems1+NumItems2 do begin SymbolArray[I].SName := GetActualNameFromResourceList(ListID2, I); SymbolArray[I].LID := ListID2; end; { for } SortArray(SymArray, NumItems1+NumItems2, 1); ... HTH, Raymond
  7. Sam, For 2D objects that have a rotation attribute, HAngle() will return an object's rotation, and the object can be Screen or Planar. It used to work only on Lines, Arcs (sweep), and Symbols, but now it works on Rectangles, Ovals and Rounded Rectangles, in addition to Arcs, Symbols and PIOs. HTH, Raymond
  8. @Coombed , Is it one object or many? If it is one or only a few, you can easily redraw it (them) using the Circle Tool in the 3-points mode (3rd mode icon), then select and delete the lines. If there are too many to manually redraw, you could convert them with a script. If you need help there, send me the file, or just send the corrupt objects, and I'll try to make a helpful suggestion. Raymond
  9. Damn, you're fast. Then it must be my machine / software. Thanks, I'll try again if and when I get a new computer. 😉 Raymond
  10. Hi _c_, When I try to open your WebArchives in Safari I get a flurry of errors repeating in a new blank Tab. The following message keeps flashing on the Safari screen as if it's stuck in an infinite loop, or there are just so many errors queued up I close the Tab before they finish. I've also tried to open the files with Firefox and I get a message asking if I want to open them with Safari. That's kind of funny. Can you open the webarchive files on your system? If so, it may be an OS thing. I am still on OS 10.11.6, and Safari is v11.1.2. I may need newer software. Raymond
  11. Hi Michael, I didn't read through all of your code, but I do see a mistake in your first FOR loop. You only index to the next layer inside an IF statement testing for Design Layers. If the layer is not TYPE 1 (a Design Layer) you don't index through the Sheet Layers. You need to move the NextLayer() call to the bottom of the FOR loop like this: For Counter := 1 to HowManyLayers DO BEGIN LyrTypInt := GetObjectVariableInt(LayerInQuestion, 154); {***************************************************************************} {Layer type 1 is a design layer. Ignore and go to the next layer.} IF (LyrTypInt = 1) THEN Begin { LayerInQuestion := NextLayer(LayerInQuestion); } {vvv Move to bottom of FOR loop vvv} { Do Design Layer stuff here, or remove this IF if there is nothing to do } End; {If LyrTypInt is 1 (i.e. Design Layer)} {***************************************************************************} {Now we're in business. Layer type 2 is a Sheet Layer} IF (LyrTypInt = 2) THEN Begin ShtLayer[SheetsOnly] := LayerInQuestion; ReportStr := Concat(ReportStr, GetName(ShtLayer[SheetsOnly])); SheetsOnly := SheetsOnly + 1; End; {If LyrTypInt is 2 (i.e. Sheet Layer)} LayerInQuestion := NextLayer(LayerInQuestion); {**** It works best here ****} END; {1 to number of layers} HTH, Raymond
  12. You're welcome. I like the easy answers. You get full credit, just for using your memory. 😉 Raymond
  13. @relume , Use: def vs.ConvertToPolygon(h, resolution):    return HANDLE Setting integer "resolution" higher creates more vertices. Notes: 1) This function creates a duplicate object, so you don't have to duplicate it beforehand. 2) If the original is selected, the duplicate will be selected, and vice versa. 3) Magic numbers for the resolution are powers of 2. Raymond
  14. Hi Dave, Use SetName(). If you have a symbol named 'Bob', the following will change the symbol's name to 'Larry', where 'H' is a variable of type HANDLE; H := GetObject('Bob'); SetName(H, 'Larry'); HTH, Raymond


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...