Jump to content

MullinRJ

Member
  • Content Count

    1,264
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. MullinRJ

    Viewports and Planes Views

    @josue Corona , I assume you mean to do this with VectorScript, considering where you posted your question? Here's a short script showing how to copy a view. The attached file shows the same thing, using the 1st design layer to set the view and a selected viewport to receive the view setting. You can use a similar approach to get the view rotations of a working plane by using the GetWorkingPlane() command. PROCEDURE xxx; { Example script to copy a Design Layer view and apply it to a Viewport. } { Select a Viewport. Run script. } { The script copies the view from the First Design Layer to the selected VP. } { 19 Jul 2019 - Raymond J Mullin } VAR Hdl, Hvp :Handle; procedure ApplyViewFromDLtoVP(Hdl, Hvp :Handle); { Copy the view from design layer (Hdl) to viewport (Hvp). } Var B :Boolean; Vr, Vc :Vector; Begin if (GetTypeN(Hvp) = 122) & (GetTypeN(Hdl) = 31) then if GetViewMatrix(Hdl, Vc.x, Vc.y, Vc.z, Vr.x, Vr.y, Vr.z) then B := SetViewMatrix(Hvp, Vc.x, Vc.y, Vc.z, Vr.x, Vr.y, Vr.z); End; { ApplyViewFromDLtoVP} BEGIN Hvp := FSActLayer; { handle to selected VP } Hdl := FLayer; { handle to an arbitrary design layer } ApplyViewFromDLtoVP(Hdl, Hvp); UpdateVP(Hvp); RedrawAll; END; Run(xxx); Not knowing what version of VW you are running I exported the file as v2016, (and for others using older versions.) Please add a signature to your profile. It really will help people answer your questions more accurately. Raymond Copy View from DL to VP v2016.vwx
  2. MullinRJ

    Move by Points Script

    Maxwell, Not all tools have index numbers. Not sure if this one does or doesn't. Raymond
  3. MullinRJ

    convert vwx to dwg

    Simon, I opened your file in VW 2014 and exported from there. I hope all of the pieces made it through. It looked pretty good when viewed in eDrawings, but check it carefully if you can. If you need a PDF to compare it to, just ask. 30710-A- Topographic Survey-Dwyer v2014.zip Raymond
  4. MullinRJ

    Return In Message()

    You're welcome.
  5. MullinRJ

    Return In Message()

    VW 2011 was the first version that accepted Carriage Return (CR) characters in the Message Window; and Windows and Mac have different codes to accomplish this. The Mac uses CHR(13) for a CR while Windows uses CHR(13), CHR(10). So for Mac: Message('Line 1', chr(13), 'Line 2'); and Message('Line 1', chr(10), 'Line 2'); and Message('Line 1', chr(13), chr(10), 'Line 2'); and for Windows: Message('Line 1', chr(13), chr(10), 'Line 2'); all produce the same output. ______________________________________ x + VectorScript Message ______________________________________ Line 1 Line 2 ______________________________________ HTH, Raymond
  6. MullinRJ

    Script Error

    @The Hamma , That would make perfect sense, but RegularPolygon() is one of those procedures that always takes its input as mm, and not document units. So, YES, you have to scale the inputs to be mm before calling RegularPolygon(). Unfortunately, the documentation does not reflect that. Welcome to the quirky world of VS programming. : ) Raymond
  7. MullinRJ

    Learning Vector Work.

    Josue, The script @Pat Stanford showed you does not work when you are editing inside a Viewport's Annotation Space, nor inside any other container objects, i.e., Symbols, Groups, Profile space of 3D objects, etc. This is because of limitations of the FSActLayer function which only returns handles from selected objects on Design Layers and Sheet Layers. Do a search on "Waldo" in the Vectorscript Forum. You will get several hits that will show you a few lines that will return a handle to a selected object inside a container, like the Viewport's Annotation Space. Waldo is the nickname given to this kind of code that gets you a handle when you are not on a Design or Sheet Layer. Reference "Where's Waldo" to see where the name came from. Have fun and good luck, Raymond
  8. MullinRJ

    Get Symbol Instance from object in Symbol Def??

    Pat, Is the toilet symbol only used in the Bathroom symbol, or does it exist in other symbols, or by itself on the drawing? Can you post a sample file? I doubt I could recreate what you've got from your description. Raymond
  9. MullinRJ

    section arrow font

    As it was explained to me recently by Gunther Miller, the PRINT menu command is supported by APPLE, and the EXPORT menu options are support by Vectorworks. Thanks for submitting the BUG. Raymond
  10. MullinRJ

    section arrow font

    Also worth noting is that the problem does not present itself when using the PRINT menu to Print-To-PDF option. Raymond
  11. MullinRJ

    section arrow font

    Thank you for that. Could you attach a screenshot of the OIP? There are a lot of settings for this marker, and that would be a lot easier than listing them all separately. Or better yet, attach a small file that has your offending marker in it for others to examine. This should save a lot of guessing if the answer is not obvious. Raymond
  12. MullinRJ

    section arrow font

    What version of VW? What computer? What OS? You really need to add a signature with these items to get the best answers. TIA, Raymond
  13. MullinRJ

    Duplicate Symbol Script

    Hi Max, As I said, it is a "minimized" script. I must leave something for you to do ;-). Do you have the Script Reference handy? There are similar calls for 3D Symbol queries, and the naming of new symbols is very subjective. If you don't want the script to rewrite an existing one, then you will have to search for the existence of the new name. If you find it you will have to increment or change yours accordingly then check again, but there are many ways to approach this. Be creative. Gotta run now. If you have more questions post again. Heck, @PatStanford hasn't even weighed in on this. If he does you'll get another load of advice to follow. I'll check back later, Raymond
  14. MullinRJ

    Duplicate Symbol Script

    Hi Max, There is no need to duplicate a symbol instance to decompose a copy of it. Just decompose the original instance inside BeginSym() and EndSym, giving it a new name. To avoid problems later, it is best to do all your dirty work at the origin. Move symbol to (0, 0) and unrotate before demo and rebuild. To leave an instance in place, place the new symbol at the same XY/Rot as the original symbol when you are done. Here a minimized script to do just that. PROCEDURE MakeUnique; VAR Selection : HANDLE; X, Y, Rot :Real; BEGIN Selection := FSActLayer; { get handle to Sym } GetSymLoc(Selection, X, Y); { get insertion point } Rot := hAngle(Selection); { get rotation } hMove(Selection, -X, -Y); { movet to origin } hRotate(Selection, 0, 0, -Rot); { unrotate } BeginSym('Sym New'); SymbolToGroup(Selection, 0); if (GetTypeN(LActLayer) = 11) then Ungroup; EndSym; Symbol('Sym New', X, Y, Rot); { place new symbol on drawing } Sysbeep; { make noise when done } END; Run(MakeUnique); HTH, Raymond
  15. MullinRJ

    Duplicate Symbol Script

    Instead of using DoMenuTextByName(), use BeginSym() and EndSym calls before and after your duplication code, respectively. Raymond
  16. MullinRJ

    3D Polyline length

    Hi Julian, Interesting approach. I knew you'd approach it differently than I. When you said your code might be quicker, it got me thinking. Your code is definitely more concise (quicker to code), but with the create and delete operations the execution speed can be an issue if large numbers of Polys need processing. For small object counts (<1000), both routines execute fast enough to be efficient. However, given enough objects the NURBS routine can appear painfully slow. I measured the two routines processing 1K, 10K, and 100K 3D Polygons. Each poly had 10 vertices. Here's what I got. Poly | JC RM | JC RM Count | Ticks Ticks | Time Time 1K | 57 4 | .95s .07 s 10K | 551 21 | 9.2 s 0.35 s 100K | 5586 175 | 93.1 s 2.92 s Sam, Bottom Line: pick the routine that will work best for your application based on your expected object count. 1-1000 Polys, shorter code looks better and is easier to support. >1000 Polys, summing the vertex distances will be much faster. VectorScript can get data from objects and process numbers and calculations much faster than it can create and delete objects. Just something to keep in mind when designing your coding approach. HTH, Raymond
  17. MullinRJ

    Connect polyline endpoint to object/symbol

    Hi @Pat Stanford , you guessed it. I initially got hung up using "0". Once I used -1, it got easier. The second and third modes, Collinear and Parallel were much easier to guess how they worked, and with the tech note using symbol wasn't too hard either. Not to make two points of the same object coincident, but the call uses two points on an object to define an edge for Parallel, and Collinear. I'm not sure that's wha you mean, though. Raymond
  18. MullinRJ

    3D Polyline length

    Hi Sam, After a quick search, I could not find a function that works on 3D Poly, like hPerim() works on 2D Polys. It may be out there, but I could write the routine to sum the legs faster than I could search for a function that does or doesn't exist. But, @Pat Stanford is correct, I've already done that and found one in my script archive. Damn, I wrote it more than a decade ago. I'm getting old. Hey, it's another example using Vectors. DOUBLE BONUS! PROCEDURE Get3DPolyLen_Example; { 20 Dec 2008 - Raymond J Mullin } function Get3DPolyLen(H :Handle) :Real; { Return the perimiter length of 3DPoly H. If H is not a 3DPoly, return 0. } Var I, N :Integer; L :Real; P0, Pa, Pb :Vector; Begin L := 0; if (GetType(H) = 25) then begin N := GetVertNum(H); GetPolyPt3D(H, 0, P0.x, P0.y, P0.z); { 1st vertex } Pa := P0; { copy of 1st vertex } for I := 1 to N-1 do begin GetPolyPt3D(H, I, Pb.x, Pb.y, Pb.z); { vertices 2 through N } L := L + Norm(Pb-Pa); { NORM is the vector DISTANCE function } Pa := Pb; end; { for } if IsPolyClosed(H) then L := L + Norm(P0-Pb); { distance from last to first points } end; { if GetType } Get3DPolyLen := L; End; { Get3DPolyLen } BEGIN AlrtDialog(concat('3D Poly Length = ', Num2StrF(Get3DPolyLen(FSActLayer)))); END; Run(Get3DPolyLen_Example); HTH, Raymond PS - if a native function exists, my bet is @Julian Carr or @JBenghiat would know.
  19. MullinRJ

    Connect polyline endpoint to object/symbol

    @boro, It took a bit of trial and error for me to figure out how the SetBinaryConsrtaint() function works, but I finally got it. It is NOT intuitive! Here is a very simple example showing how to join the endpoints of two lines together. PROCEDURE SBC_1_Example; { Constrain two lines to share a common point. } { In this example, Pt1 of Line 1 (obj1VertA = 1) is to be coincident to Pt2 of Line 2 (obj2VertA = 2). } { Line 1 will move so its StartPoint is coincident with Line 2's EndPoint. Line 2 will not move. } { The angles of both lines will remain unchanged. } { } { Select two lines and run the script. Line 1 is the first selected object and Line 2 is the second. } { For option 1 (Coincident Points), the second vertex of each object is not needed, so -1 is passed to } { the "obj1VertB" and "obj2VertB" parameters, while 0 is passed to both "containedObj" parameters. } { } { At the end of the script, the Message Window shows the function's result (T/F) amd the numeric type } { of each selected object (LineType = 2).} { 27 Apr 2019 - Raymond J Mullin } VAR H1, H2 :HANDLE; result :BOOLEAN; BEGIN H1 := FSActLayer; { Line 1 handle } H2 := NextSObj(H1); { Line 2 handle } result := SetBinaryConstraint(1, H1, H2, 1, -1, 2, -1, 0, 0); message(result, ' ', GetTypeN(H1), ' ', GetTypeN(H2)); END; RUN(SBC_1_Example); HTH, Raymond
  20. MullinRJ

    Connect polyline endpoint to object/symbol

    I just tried it with a Polyline connected to two symbols and the Polyline does not scale when one symbol is moved, like the LINE does; so maybe you can't do exactly what you want. Hopefully you can get by by using a LINE. Raymond
  21. MullinRJ

    Connect polyline endpoint to object/symbol

    Boro, I just tried this for the first time and it seems to work. Use the Constrain Coincident tool to attach one endpoint of a Line to Symbol A and use it again to attach the other end of the Line to Symbol B. Now when you move either Symbol A or Symbol B the endpoints of the Line will move to stay "attached" to each symbol. It works when done manually. I assume it can be scripted. Additionally, if you move the Line, then both symbols will move, too. Good luck, Raymond
  22. MullinRJ

    Draw Negative of Arc?

    Craig, Alternately, you can use the Reshape Tool, 3rd option - Change Vertex Mode, assuming as Pat did that this is a 2D Polygon. 1) Select the polygon, and double click on the Reshape Tool. This opens up the Fillet Settings dialogue box. (You can also click on the last icon on the far right – Reshape Tool Preferences.) Set the radius to the width of your rafter. 2) Select the Change Vertex Mode (1st group), and the Fillet (Circular Arc) Point Mode (2nd group). 3) Click on the vertex to modify. In your example, it's the lower left vertex. (Ignore my units, it's just an example. Use your rafter width instead.) Pat's right, there are other ways, but easier is a judgement call. Pick one you like and keep going. HTH, Raymond
  23. MullinRJ

    Until Next Time

    Tom, Do you realize Jim is not gone, he's just not an employee at the moment? Your statement is pretty harsh, and I don't think the rest of the VW employees deserve it, but good luck in your future endeavors. I'm sure you will be missed here, too. Raymond
  24. MullinRJ

    ExportImageFile does nothing

    Yes. This one liner will show the compression used on a placed image: vs.Message(vs.GetObjectVariableLongInt(vs.FSActLayer(), 532)) # 1 = JPEG, 2 = PNG Raymond
  25. MullinRJ

    Until Next Time

    First Norte Dame, now YOU! This is a rough April. I hope to see you on the boards soon. Be well. Be happy. Raymond PS - This was not your best Teaser-Tuesday. Just sayin'.

 

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.

×