Jump to content

Alexandre Villares

  • Posts

  • Joined

  • Last visited

Everything posted by Alexandre Villares

  1. Samurai, Remember the PIO is not redrawn on every view change. So the code does not run so often...
  2. Hi, The HANDLE code is very useful when your script is going to change an existing object. In this case you can do something simpler, choose your VectorFill/Hatch and Wall tool before you try the CustomTool/Attributes... at the Organise menu. It will write for you a script more or less like this (I removed some parts I didn't like): code: Procedure CustTool; VAR Name:STRING; Result:BOOLEAN; BEGIN PushAttrs; Name:= 'My Special Hatch #23' Result:=SetVectorFillDefault(Name); CallTool(-208); PopAttrs; END; Run(CustTool);[/code] [ 02-05-2003, 10:30 AM: Message edited by: Alexandre B A Villares ]
  3. don't bother to do 1) it simply isn't how it is suposed to work. Now, about 2): You have to rotate your extrudes after creating them. As in this example I've writen: code: Procedure SillyWindow; VAR objectName,objectClass : STRING; objectHand, recordHand, wallHand: HANDLE; {Parameters used: LINELENGTH & BOXWIDTH (from the rectangular PIO) E (thickness) & A (height from floor) } BEGIN {-----------2D part-----------} Rect (0,PBOXWIDTH/2, PE, -PBOXWIDTH/2); Rect (PLINELENGTH-PE,PBOXWIDTH/2, PLINELENGTH, -PBOXWIDTH/2); IF GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand) THEN BEGIN objectClass:=GetClass(objectHand); NameClass(objectClass); END; FillColorByClass; FPatByClass; LWByClass; LSByClass; PenColorByClass; {plan view rect} Rect ( 0, -PBOXWIDTH/2,PLINELENGTH,PBOXWIDTH/2); HMoveBackward(LNewObj, TRUE); {FALSE=Backward TRUE=Back} {-----------3D part-----------} BeginXtrd(0,PBOXWIDTH); Rect (0,0, PLINELENGTH, PE); Rect (0,PA-PE, PLINELENGTH, PA); Rect(0, PE, PE, PA-PE); Rect(PLINELENGTH-PE, PE, PLINELENGTH , PA-PE); EndXtrd; Set3DRot(LNewObj,90,0,0,0,0,0); Move3DObj(LNewObj,0,PBOXWIDTH/2,0); END; Run(SillyWindow); [/code] [ 02-04-2003, 07:25 PM: Message edited by: Alexandre B A Villares ]
  4. 1. Can you loft between 3D objects? i.e. creating a transition piece between a shin pipe and a thick pipe. Or do you have to do it using 2D poly things (yes *I* know what i'm talking about ) The old VW tool called Multiple Extrude works with 2D poly stuff, it's pretty basic. The new (VW9.5 onwards) Loft Tool works on 3D Curves... don't miss it! Extract (with the Extract Curves Tool) the edges of the pipes you wish to loft between. 2. How do you round edges? Blend edge tool? 3. Why is it, when sometimes I extrude a 2D thing that i create out of lines, it only extrudes the lines (border) even if the entire object is Attributed to be solid? Does it HAVE to be a 2D poly? Extruded lines will become sort of useless 'faces' You'll have a lot more fun extruding Polygons or Polylines. That's the idea. Use the Compose or the Dual Object Combine to transform your lines into Poly stuff. 4. And your personal opinion: To model an acoustic guitar accurately using Vectorworks: is this a difficult task for a newbie? (I am looking for a challenge by the way). And how would you recommend modelling it? Go for it! Have a look at the 3DPower Pack tutorials... 5. Any other nice little things that you appreciated learning when you began using Vectorworks!?!?!?! Most of the basic 3D objects (Extrudes, Solid Operations, Floors, Sweeps) can be edited with the 'Edit Group' command (at the Organise menu). Ungroup will undo some of them too.
  5. code: PROCEDURE Extend; {* by Sean Flaherty of Graphsoft, Inc. *} {* Takes the selected lines and extends them to a line *} {* chosen by the user. *} VAR theList, theObj : Handle; whereX, whereY, px, py, vx, vy : REAL; ? FUNCTION CrossP( x1, y1, x2, y2 : REAL) : REAL; BEGIN CrossP := x1 * y2 - x2 * y1; END; ? FUNCTION DistToV( x, y : REAL ) : REAL; VAR num, denom : REAL; BEGIN num := Abs( CrossP( x - px, y - py, vx, vy )); denom := Sqrt( vx**2 + vy **2 ); DistToV := num / denom; END; ? PROCEDURE GetEquation( x1, y1, x2, y2 : REAL; VAR slope, off : REAL; VAR inf : BOOLEAN ); BEGIN IF x1 = x2 THEN inf := TRUE ELSE BEGIN inf := FALSE; slope := ( y2 - y1 ) / ( x2 - x1 ); off := y1 - slope * x1; END; END; ? PROCEDURE ExtendLine( u : Handle ); VAR s1x, s1y, s2x, s2y, rx, ry : REAL; FUNCTION SectToV( a1x, a1y, a2x, a2y : REAL ) : BOOLEAN; VAR infA, infV, tmpBool : BOOLEAN; slopeA, slopeV, offA, offV : REAL; ????????? BEGIN GetEquation( a1x, a1y, a2x, a2y, slopeA, offA, infA ); GetEquation( px, py, px + vx, py + vy, slopeV, offV, infV ); IF infA & infV THEN tmpBool := FALSE ELSE BEGIN tmpBool := TRUE; IF infA THEN BEGIN rx := a1x; ry := slopeV * rx + offV; END ELSE IF infV THEN BEGIN rx := px; ry := slopeA * rx + offA; END ELSE IF slopeA <> slopeV THEN BEGIN rx := ( offV - offA ) / ( slopeA - slopeV ); ry := slopeA * rx + offA; END ELSE tmpBool := FALSE; END; ????????? SectToV := tmpBool; END; BEGIN GetSegPt1( u, s1x, s1y ); GetSegPt2( u, s2x, s2y ); ????? IF DistToV(s1x,s1y) < DistToV(s2x,s2y) THEN BEGIN IF SectToV(s1x,s1y,s2x,s2y) THEN SetSegPt1(u,rx,ry); END ELSE BEGIN IF SectToV(s1x,s1y,s2x,s2y) THEN SetSegPt2(u,rx,ry); END; END; BEGIN theList := FSActLayer; IF theList <> NIL THEN BEGIN Message( 'Pick the line to extend to' ); GetPt( whereX, whereY ); ClrMessage; theObj := PickObject( whereX, whereY ); IF ( theObj <> NIL ) & ( GetType( theObj ) = 2 ) THEN BEGIN {* set the constraining vector *} GetSegPt1( theObj, px, py ); GetSegPt2( theObj, whereX, whereY ); vx := whereX - px; vy := whereY - py; ????????? WHILE theList <> NIL DO BEGIN IF GetType( theList ) = 2 THEN ExtendLine( theList ); theList := NextSObj( theList ); END; END; END; END; RUN( Extend ); [/code]
  6. The code sent by Ian works perfectly on VectorWorks 9 and 10 without any modification. It could be re-writen a lot simpler in VW10 but that's not the point. It can be used from a script palette or be made into a 'tool', like the others on the 2D Tools/Editing Palette. regards, Alexandre [ 01-30-2003, 09:08 PM: Message edited by: Alexandre B A Villares ]
  7. Hi Ian, You can send it to me, I'll be glad to have a try on updating it to VW9 & VW10. regards,
  8. Any tip on how to get the 3D position of a PIO on VS 9.5 ? I think I remember that Get3Dcntr() didn't make it. []s A
  9. I hope this message is not inapropriate at this board, but I have made a Polygonal Clip Tool with VectorScript. sample movies Please contact me in private if interested. [ 01-16-2003, 08:37 AM: Message edited by: Alexandre B A Villares ]
  10. First you'll need to find the Plug-in Object's handle (PIOHandle). Then use SetRField. Note that the parameter value must be passed as a String, even if it's a Real or Integer parameter (note the Num2Str() I used). IF GetCustomObjectInfo(PIOName, PIOHandle, recordHand, wallHand) THEN BEGIN {...} SetRField(PIOHandle,Getname(recordHand),'parametername', Num2Str(8,RealNumberParameter)); {...} END; Also beware that the Pparametername is a sort of constant that will remain the same until the user changes something at the OIP. So if you change a parameter using this procedure and you need to use the updated value, you'd better use some variable to store it or you'll have to use GetRField. HTH [ 01-13-2003, 06:09 AM: Message edited by: Alexandre B A Villares ]
  11. I've tried to make an auto-classing text tool with VS but it didn't work due to some problem with SetTooll(-200)/CallTool(-200). I haven't tried it on VW10 yet. Any insight on this is welcome. [ 01-11-2003, 01:14 PM: Message edited by: Alexandre B A Villares ]
  12. Just a comment... Using VS as it is now you can have a pop-up paramenter named 'calculate:' top / bottom / height And then use some code to force the calculated stuff into the OIP On VW10 you can even make the calculated paramenter show greyed or be invisible
  13. Katie, I'm afraid that the Text tool is one of the few tools that is not available when using the Custom Tool/Attribute... command. This doesn't mean you can't use the Custom Tool/Attribute to set the active class for the next text object or its font/attributes. It means it won't call the Text Tool. I wonder if this is related with a VesctorScript trouble I had using CallTool()/SetTool() with the text tool... and I can't remember if I filled a bug report already. [ 01-09-2003, 07:44 PM: Message edited by: Alexandre B A Villares ]
  14. I like to think about these class experiences you are describing in terms of container and content. VectorWorks allows many container objects like symbols, groups and Plug-In Objects (PIOs for short) to have a different class from the objects inside them. The class of the container object can always be changed using the Object Info Palette (OI Palette). The (container) class of a symbol the first time it is inserted depends on it's Insertion Options, it might take the active class (an option called Default...), the 'None' class or some other pre-set class. Then the class of each object inside a Symbol, its content, can be changed by editing it (editing the symbol definition). When you create a group by grouping some objects, the container group is always automatically set to the 'None' class, and if you try to change it through the OI Palette you might be asked about changing the contents' class or not. The Plug-in Objects also have a sort of insertion option (actually at the Propreties... settings) called default class, like Katie was telling earlier on this thread, and they can also, after inserted, have their 'container' class changed at the OI Palette. But the class of the objects inside a PIO depend on its code. Many PIOs have some or all of its internal parts set to the 'None' class. Many PIOs like the Stair or Window can have parts (specially some 3D parts) set to a certain class (i.e. Step Finnish: Style-1; Trim and Sill 1: None; Glazing: Syle-Glazing 1) using parameters at the OI Palette. Other PIOs, like some annotative markers I've made, can put their content on the same class as the 'container'. Yet, if you set a PIO (the container) to a class with the Use at Creation option, that can have an effect on its graphic attributes even if its parts are set to the 'None' or to another class... This is never the case with symbols, the container class has no influence at all on its contents' graphic attributes. And then, if you set the 'None' class with Use at Creation, it's attributes are very likely to appear at strange places. HTH [ 01-07-2003, 08:24 PM: Message edited by: Alexandre B A Villares ]
  15. Dan, You can simply rename de Dimensions class! Drawn dimensions will still go to this class, all you have to do is go to the Classes... panel and hit Edit to change it's name. I recommend you create Templates for your office with this arragement. (FYI internally the Dimensions class is described by VW by the index 2, None is 1, so the names can be renamed at will). Raymond, I badly needed an offset poly code for a VW9.5 client recently... It was about calculating earth removed from foundation blocks escavation... and I ended up making an aproximation thing not a very nice solution. [ 01-07-2003, 09:26 AM: Message edited by: Alexandre B A Villares ]
  16. Another nice trick is to make a 2D section cut, make it thick, ungroup it, convert it to 3D polys and plug it on your 3D section.
  17. Hi! You declared p1 and p2 as REAL instead of POINT. best regards,
  18. I've been thinking about your request. 1. What hapens if the vertices of your original 3D poly are not on the same plane? 2. I think the main difficulty is to draw the 2D poly exactly on top of the 3D one on the rotaded view. 3. Then again, after the extrusion it might not be on the same plane and will have to be moved.
  19. The VectorScript CallTool function wasn't working properly with the Text tool... CallTool(-200)...if that was fixed (I'll try to check it out on VW10) then a customizable auto-classing text tool can be programmed. I've already made an auto-classing wall tool for a client, and it's quite handy.
  20. 4AM here, I couldn't help give the problem a try... How about: {NOT TESTED!} PROCEDURE UpClass; FUNCTION UpHnd(h:HANDLE):BOOLEAN; BEGIN IF GetClass(h)='class-to-be-sent-up' THEN HMoveForward (h, TRUE ) ; END; BEGIN ForEachObjectInLayer(UpHnd,4,1,1); END; Run(UpClass); ---------- PROCEDURE ??ForEachObjectInLayer ( ? actionFunc :PROCEDURE; ? ? objOptions :INTEGER; ? ? travOptions :INTEGER; ? ? layerOptions :INTEGER ) ; Object Options All objects 0 Visible Objects only 1 Selected Objects only 2 Unlocked objects only 4 Traversal Options Traverse Shallow 0 Traverse Groups 1 Traverse Deep 2 Layer Options Current layer 0 All layers 1 Visible layers 2 Editable layers 4 Snappable layers 8
  21. GridLines(gridDistance:REAL); Sets the grid distance PenGrid(gridDistance:REAL); Sets the snap distance But I couldn't find anything about getting the current values... PS: Some Grid related Preference selectors I found: Show Grid 35 TRUE or FALSE Print Grid 36 TRUE or FALSE Snap To Grid 37 TRUE or FALSE Grid Angle 73 REAL
  22. I think I heard something at the VS-List about LNewObj giving you the handle to the last object created by your script, BUT that objects created with 'DoMenuBy...' (such as 'Paste' on Raymond's terrific duplicate script) would 'escape the internal VS sequence'. You could try creating a dummy object (usually a locus, and we call him Waldo) getting it's handle, doing your your stuff, locating the objects in relation to Waldo and then deleting him.
  23. It would be great if the clip tool (the one with an eraser icon) had a polygonal marquee mode. It would be very usefull as a way of quickly trimming multiple objects on a sloped border, as it works on selected objects only and you don't need to manually delete the unwanted parts of the sectioned items.
  24. {Create a new VectorScript Plug-in Command with this...} Procedure RotateSel45; VAR centerX, centerY:REAL; p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y:REAL; FirstBBox:BOOLEAN; {--------------} Function AddBBox(Hnd:Handle):BOOLEAN; BEGIN IF FirstBBox THEN BEGIN GetBBox (Hnd, p3X, p3Y, p4X, p4Y); FirstBBox:=FALSE; END ELSE BEGIN GetBBox (Hnd, p1X, p1Y, p2X, p2Y); UnionRect(p1X, p1Y, p2X, p2Y, p3X, p3Y, p4X, p4Y, p3X, p3Y, p4X, p4Y); END; END; {--------------} Procedure FindCenter; BEGIN Rect(p3X, p3Y, p4X, p4Y); HCenter(LNewObj, centerX, centerY); DelObject(LNewObj); END; {--------------} Function RotateHnd45(Hnd:HANDLE):BOOLEAN; BEGIN HRotate(Hnd, centerX, centerY, 45); END; {--------------} BEGIN FirstBBox:=TRUE; {init. BBox variable} ForEachObjectInLayer (AddBBox, 6, 0, 4 ); {selected+unlocked, shallow , editable layers} FindCenter; {gets centerX and centerY} ForEachObjectInLayer (RotateHnd45, 6, 0, 4 ); {Rotates 45d around centerX, centerY} END; Run(RotateSel45); {Hope this helps...} [ 12-01-2002, 09:41 AM: Message edited by: Alexandre B A Villares ]
  • Create New...