Jump to content

AEChadwick

Member
  • Posts

    44
  • Joined

  • Last visited

Reputation

3 Neutral

Personal Information

  • Occupation
    Set Designer
  • Homepage
    http://www.imdb.com/name/nm1953213/
  • Location
    Los Angeles

Recent Profile Visitors

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

  1. totally. plus, i can tell if the oval is tall or wide just by comparing it's height and width. the bounding box... it actually DOES retain something of the rotation state, i just have no idea how to access it: if you scrub over the handles they will identify "top left" and "bottom left"--and those positions do NOT change with rotation, they remain true to "how was it originally drawn" (ie., top left might end up in the lower left corner). If i could access that information, i could compare it to width and determine if the oval was drawn tall and then rotated. (in the screenshot above? the Left Oval is drawn-tall-then-rotated, P1 identifies as "upper right." The Right Oval was drawn long and left in place, P1 identifies as "upper left") it's a weird situation, that's why i'm grateful for the help.
  2. bugger me, but GetBBox doesn't seem to discern rotation/origin/whatever... a quick add to get points GetBBox(obHd, Oval_p1X, Oval_p1Y, Oval_P2X, Oval_P2Y); a quick add to mark those points TextOrigin(Oval_p1X, Oval_p1Y); CreateText('P1'); TextOrigin(Oval_P2X, Oval_P2Y); CreateText('P2'); and regardless of wrongness, upper left is upper left and lower right is lower right. i'll look more in the morning
  3. hey man, thank you for taking a look. ("IsObjectFlipped" applies to 3D i think?) I tried checking "IsFlipped" but the results made no difference. as for GetBBox... I suppose i could get the bounding points and make a comparison to see where "TopLeft" falls relative to the center point, but that seems like an intense solution. I'll save that in my backpocket. —Æ
  4. This is a quick script to mark the Foci of an Ellipse. It just does math on a selected oval. (It does no checking yet, it will do the math on anything.) Weird error... this works fine on ovals drawn "long", rotated, flipped, whatever, the Foci get marked right. but if the oval was drawn "tall" the math is done on the wrong dimensions and the markings are wrong. you can redraw a "wrong" oval by drawing it long-way-first and then adjusting it to any orientation you need, it will then get marked correctly. Maybe this involves the handle to the Bounding Box? Maybe there's some way to determine if an object is reoriented...? I have attached a file with the script and some examples, would love to see if anyone has an insight. i always learn cool things here. —AE PROCEDURE EllipseMarker; VAR obHd : HANDLE; x, y, MajorAxis, MinorAxis, Foci, ObjectWidth, ObjectHeight, thePerimeter, layScale, TheOffset, theAngle, theAngleModifier : REAL; thePerimeterString : STRING; BEGIN obHd := LSActLayer; layScale:= GetLScale(ActLayer); TheOffset := (layscale*.25); WHILE NOT(obHd=NIL) DO BEGIN HCenter(obHd, x, y); theAngle := HAngle(obHd); ObjectHeight := HHeight(obHd); ObjectWidth := HWidth(obHd); If ObjectHeight > ObjectWidth then begin MajorAxis := ObjectHeight; MinorAxis := ObjectWidth; theAngleModifier := 90; end else begin MajorAxis := ObjectWidth; MinorAxis := ObjectHeight; end; Foci := Sqrt( SQR(MajorAxis/2) - SQR(MinorAxis/2) ); BeginGroup; MoveTo(x-ObjectWidth/2-TheOffset, y); LineTo(x+ObjectWidth/2+TheOffset, y); MoveTo(x, y-ObjectHeight/2-TheOffset); LineTo(x, y+ObjectHeight/2+TheOffset); MoveTo(x-Foci, y-TheOffset/2); LineTo(x-Foci, y+TheOffset/2); Locus(x-Foci, y); TextOrigin(x-Foci, y-TheOffset/2); CreateText('F1'); MoveTo(x+Foci, y-TheOffset/2); LineTo(x+Foci, y+TheOffset/2); Locus(x+Foci, y); TextOrigin(x+Foci, y-TheOffset/2); CreateText('F2'); BeginPoly; ClosePoly; AddPoint(x+Foci, y); AddPoint(x-Foci, y); AddPoint(x, y+ObjectHeight/2); EndPoly; SetLSN(LNewObj, -561); thePerimeter := HPerimN(LNewObj); thePerimeterString := Num2Str(1,thePerimeter); TextOrigin(x, y+TheOffset); CreateText(Concat('String ',thePerimeterString,'"')); EndGroup; DSelectAll; SetSelect(LNewObj); RotatePoint(x,y,theAngle+theAngleModifier); DSelectAll; obHd := PrevSObj(obHd); END; END; RUN(EllipseMarker); Script to Mark Ellipse.vwx
  5. leaving this here for future searches... here’s a quick terminal one-liner (using perl) to round numbers in a file. perl -i -pe 's/[-+]?\d*(?:\.?\d|\d\.)\d*(?:[eE][-+]?\d+)?/sprintf("%.4f",$&)/ge' [file] -i makes the changes “in place,” and "%.4f" in the sprintf controls the decimal places (in this case, 4 places) be careful—this is fast, and powerful, and it will check EVERY number it finds (Add2DVertex will become Add2.0000DVertex, Pos1.x will become Pos1.0000x) a text file like this... comes out like this... then a little manual cleaning will get it down further... (there’s probably syntax that would strip leading and trailing zeros, but i wanted to post this while i was thinking of it) —AE
  6. wtf, Paolo, that's amazing! you are fantastic. the Fox mill’s website is a mess, but i have a set i downloaded ages ago (the profiles have not changed). I will PM you a link.
  7. Totally. That's similar to how i have been creating the instruction sets to build profiles—exports from my own library of polylines of the Paramount and Fox catalogs. (Aren't those numbers something??? "-0.500000000000036" and "-0.500000000000035", like, really...?) That plug-in is excellent, it's another lovely example of the idea. It doesn't allow the illustrative customization that i want, but i appreciate seeing different versions.
  8. hey Mr O! thanks for joining in. Pick-and-place is a fine solution, but procedural generation of each profile will lend itself to several ideas i have for on-the-fly customization. I’ll check back in once i have developed something. (Hope your surgery went well! keep ice on that jaw!) —AE
  9. i've seen that plugin! it's lovely work. but. it doesn’t use the Paramount and/or Fox catalogs. and. it doesn't draw to my particular style (i love writing PIO to do my specific drawing for me...) also. my mill doesn't need 3D anything, they just want to see the profiles and read the numbers. : )
  10. I appreciate any insight; there’s not much more to specify, but i'm happy to explain and i respect you taking the time. I have profiles of every piece if moulding from several common catalogs; i keep them as a symbol library to add into drawings. My Production Designers often change their minds from moment to moment, which leads to searching, copying, pasting, etc. I figure i could speed the process up with a PIO Point Object to just change between any molding with a couple clicks—turn every profile into a series of commands, and simply case-switch through them based on catalog and number. (I think a plugin that draws the object is more flexible and more fun than something that simply automatically calls up the existing symbols. it introduces some fun ability to customize the piece on the fly.) Since I already have the profiles, it's quick work to just export—with some cleaning up. (I don't trust any script as a straight export, i just use the export as a jumping off point.) For example... NameObject('P143 Section'); ClosePoly; BeginPoly; MoveTo(0",-4.687499999999996"); MoveTo(0",-2.797591863254474"); MoveTo(2.79882798298577",0.000000000000004"); MoveTo(4.67684947143633",0.000000000000001"); LineTo(4.67684947143633",-0.737820846534148"); ArcTo(0.704415179296854",-0.715267855549387",3.904543571406666"); LineTo(0.750400322129494",-4.687499999999996"); EndPoly; SetVertexVisibility(LNewObj,0,false); SetVertexVisibility(LNewObj,1,false); SetVertexVisibility(LNewObj,2,false); Becomes part of a procedure, like... ClosePoly; BeginPoly; MoveTo(FromX+0",FromY-4.687"); MoveTo(FromX+0",FromY-2.8"); MoveTo(FromX+2.8",FromY+0"); MoveTo(FromX+4.68",FromY+0"); LineTo(FromX+4.68",FromY-0.738"); ArcTo(FromX+0.70",FromY-0.72",3.90"); LineTo(FromX+0.75",FromY-4.68"); EndPoly; SetVertexVisibility(LNewObj,0,false); SetVertexVisibility(LNewObj,1,false); SetVertexVisibility(LNewObj,2,false); i've done a similar thing in a couple PIO—using the result of an export to draw a decorative feature as part of a bigger process. It works great, and honestly the clean-up process is kind of fun—finding all the patterns and recurring numbers and shapes. but... i think after 300 profiles i might get fatigued... Anyway, roll that all through your head. I appreciate all your contributions. (And I love when JBenghiat enters a discussion, i hope he throws something in here too!)
  11. Mr Stanford, I rely on you for the cold truth. I always appreciate your responses. (I kind of figured this would end with me writing a script to process the results of the export’d script.)
  12. I have been using “Export Script” to quickly create instructions for a series of simple polygons (moulding profiles). Does anyone know any way to decrease the dimensions from 15-decimal-point accuracy to maybe 2 or 3 points? Even the simplest shape results in charming-but-ludicrous numbers like... LineTo(2.79882798298577" , 0.000000000000004"); Honestly, rounded numbers would be fine—besides, i swear that Y point is really at 0... LineTo(2.8" , 0"); I usually edit the numbers manually, but my next project involves about 500 polygons and i would love to streamline the process. I have looked through vectorworks preferences and document preferences, and I have tried different Page Unit settings. I cannot determine where export script accuracy is derived. If there is no way inside Vectorworks, I will simply export everything to a text file and use a separate shell script to just round every number.
  13. oh this is lovely! i’m going to play with it right now. Thank you for posting! —Æ
  14. 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);
×
×
  • Create New...