Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About AEChadwick

  • Rank

Personal Information

  • Occupation
    Set Designer
  • Homepage
  • Location
    Los Angeles
  1. oh this is lovely! i’m going to play with it right now. Thank you for posting! —Æ
  2. Hello friends I have long desired an extensible way to add automatic ID numbers to my custom PIOs, and finally took a day to cobble one together. I am submitting it here for perusal, please offer suggestions. (caveat: I know am a hack coder, please don’t be unkind.) (also, i try to name variables knowing that my future self will never remember what “wBpstXX” was ever supposed to mean.) I wanted a system that would simply start from 1 and count up, nominatively to the number of [same objects]. I wanted it to store each number so existing objects would not change their identification--but I wanted the system to fill in available numbers, like if an object got deleted the next object would re-use the available number. This example is built off a rectangle object, purely for demonstration; in addition to LineLength and BoxWidth, the script expects a parameter called __SpecialID of type Text. This is purely to store the ID (the preceding underscore makes the parameter invisible to the user). This script will draw a box and slug the number inside. (the copy-or-new routine is simply the code example from isNewCustomObject) Some nice improvements will be an optional prefix or suffix parameter, allowing things like “W11” or “18xSF" for unique reference; and maybe the ability to add trailing or leading numbers, so “4” automatically becomes “04.” But those can all follow once the basic functionality is foolproof. See what you think. —AE PROCEDURE Plugin; VAR x, y, w, h : REAL; boxLeft, boxBottom, boxRight, boxTop : REAL; pioHandle,rh,wh : HANDLE; result, IsThisCopy, WeGotOne : BOOLEAN; NumberOfPIOs : LONGINT; pioName, thisTypeOfPIO : STRING; MySpecialID, theUniqueID : STRING; theNumber : LONGINT; TheStringWeBeChecking, theStringWeNeed : STRING; PROCEDURE GoThroughEveryPIO(EachPIO : Handle); begin theStringWeNeed := GetRField(EachPIO, thisTypeOfPIO, '__SpecialID'); if theStringWeNeed = TheStringWeBeChecking then WeGotOne := FALSE; end; PROCEDURE GenerateUniqueID; Begin theNumber := 1; repeat WeGotOne := TRUE; TheStringWeBeChecking := Num2Str(0, theNumber); ForEachObject(GoThroughEveryPIO, PON=thisTypeOfPIO); if theNumber = NumberOfPIOs then WeGotOne := TRUE else theNumber := theNumber+1; until WeGotOne = TRUE; theUniqueID := TheStringWeBeChecking; IF IsNewCustomObject(pioName) THEN begin MySpecialID := theUniqueID; SetRField(pioHandle, pioName, '__SpecialID', MySpecialID); SetName(pioHandle, MySpecialID); end; IsThisCopy := MySpecialID <> GetName(pioHandle); IF IsThisCopy THEN begin MySpecialID := theUniqueID; SetRField(pioHandle, pioName, '__SpecialID', MySpecialID); SetName(pioHandle, MySpecialID); end; End; BEGIN result:= GetCustomObjectInfo(pioName,pioHandle,rh,wh); thisTypeOfPIO := (GetObjectVariableString(pioHandle,1166)); NumberOfPIOs := Count(PON=thisTypeOfPIO); MySpecialID := p__SpecialID; GenerateUniqueID; boxLeft:=0; boxBottom:=-(PBOXWIDTH/2); boxRight:=PLINELENGTH; boxTop:=(PBOXWIDTH/2); Rect(boxLeft,boxBottom,boxRight,boxTop); TextOrigin((PLINELENGTH/2),0); TextSize(12); CreateText(Concat(MySpecialID, ' of ', NumberOfPIOs)); END; RUN(Plugin);
  3. oh fer dumb. CHR(39) will insert a single quote. hope this saves some other poor bastard a search. ?
  4. Going further, here is my sloppy attempt to remove the trailing 0. I am posting this in the hopes that someone might reveal how to use the actual feet character in a string instead of my silly fado-workaround. take pity on my tortured code...
  5. Hmm. Answering my own question, just coerce it out of Num2Str in a different way: ...that's using a fado as feet because I can't figure out how to get a hatch in there; don?t judge me. Of course, that /12 assumes imperial units (which I generally use, but that seems like sloppy code). I?m open to improvement...
  6. I use a little PIO to display scale inside Viewports that includes this... this currently creates 1" = 4'0" or 1" = 23'10" What snippet of code would change that to 1" = 4' or even 1" = 24' (close enough for estimating cable runs, seriously). *would like to do this without changing the Units... of the document; hoping there is something that will round the numbers and drop the inches. Thanks! ??
  7. Miguel, you're fantastic! I had just finished cobbling two routines as "flipmult" variations (had to get out the Pythagorean Theorem for part...), but I instantly abandoned them and plugged in that DSelectAll. It worked perfectly. I had previously avoided DSelect, thunking it would drop the entire PIO... I should have experimented. Looks like everyone is learning valuable lessons today! Thanks to everyone! I absolutely love posting here, everyone is always smart and helpful [unlike most of the rest of the internet]. ?
  8. "FlipMult" is a great idea! I will attempt an implementation. ?
  9. Man, I can always count on Mr Stanford for the Hard Truth. ?
  10. I'm trying to economize code, and figured I had a clever solution... But it does not work, my procedures are lacking?I have not been able to ascertain how to simply "duplicate and mirror" a 2D object. To explain, instead of making two, separate draw door by type routines, I figured "if the door is a double, just draw half and mirror it..." the first part checks if it's a double-version and sets a couple variables: the procedure then draws the appropriate door, then duplicates itself... ...but, of course, this just flips the entire PIO, not the door-half. Am I doing the handles wrong, or missing an obvious command? I sure appreciate the help! PS. other code critique welcome, I?m know I'm a n00b, feel free to school me! ?
  11. Hey Mr Assembly! Your version looks great too, thank you for the input! I will explore your code, I love learning all of this and I love having options... In my PIO, a easy-access (read: non-modal) list of simple hatch names is the desired outcome?the hatches are fairly uniform, providing only subtle visual difference; the more important factor is the name, and the handle provided by the hatch. (like, a connected database finds everything called "Wallpaper 1" or "Paint White" and provides square footage.) ?
  12. Holy smokes, you guys are amazing! (Mr Barrera, Mr Dunning, Mr Benghiat, thank you all so much. I was just about to check in with a lame excuse about "got busy on set, still working on script," but you've beaten me to the punch.) I am going to sit and read every line until I can really parse what's happening, it really is much more complex than I allowed (pardon my youthful naivet?). I hope other folks find this as awesome and helpful as I do; thank you again for all your attention. Now: to work! ?
  13. Just to keep everyone up-to-date as I flail along. (This post live from behind Kitchen Stadium as we load in Series 11.) This script compiles but the pop-up is greyed out, useless! Why doesn?t it fill up? Just stubborn is my guess. I?m going to keep trying to comprehend Events as the kitchen comes together. (Note, if some of the lines are inscrutable, I'll admit, it's because copy-pasta... I just keep trying snippets and bits.) I appreciate all the help, and look forward to any more insights! PS. shout out to Mr Joshua, you've offered excellent advice in several threads.
  14. alright?I need to go get lunch (who spends the 4th of July scripting, anyway?!) Current non-functioning code below. (add a head-on-wall when I figured out "oh, right, Parameter Number...") Submitted for review: ***revised again, update below***
  15. Note sure, but it looks like you are missing a space between HatchNumResources and Do. facepalm. ?


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...