Jump to content

Search the Community

Showing results for tags 'rotation'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 19 results

  1. I have done quite a search and have not found any good explanation to use entmake to insert a defined block, and scale or rotate that block upon insertion. The idea is to tag a line (pipe), and add the diameter, length, and cut-length of that pipe using attributes. I have the code to get the line information ready, and was working on the entmake for the attribute block to label the "pipes". Here is the code for the attribute block: (defun c:apd (/ LAY1 LAY2 LAY3 LAY4 CLR1 CLR2 CLR3 CLR4 LTP1 LTP2 LTP3 LTP4 FONT value1 value2 value3 rotation p) ;;; Change layer names and colors to suit user. (setq LAY1 "S-Pipe-Detail" LAY2 "S-Pipe-Dia" LAY3 "S-Pipe-Length" LAY4 "S-Pipe-Cut" CLR1 1 CLR2 2 CLR3 3 CLR4 4 LTP1 "Continuous" LTP2 "Continuous" LTP3 "Continuous" LTP4 "Continuous" FONT "Standard" ) ;;;======================== Block Definition ====================== (defun DEF_PipeDetail () ;generated using EntMaker CAB 04- MakeEntmake.lsp (entmake '((0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockReference") (66 . 1) (2 . "PipeDetail") (10 0.0 0.0 0.0) (70 . 2) ) ) (entmake '((0 . "ATTDEF") (100 . "AcDbEntity") (67 . 0) (8 . "S-Pipe-Dia") (100 . "AcDbText") (10 0.0 0.0 0.0) (40 . 0.095833333333331) (1 . "-DIA-") (50 . 0.0) (41 . 0. (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 1) (100 . "AcDbAttributeDefinition") (280 . 0) (3 . "PIPE DIAMETER:") (2 . "DIA") (70 . 0) (74 . 1) (280 . 0) ) ) (entmake '((0 . "ATTDEF") (100 . "AcDbEntity") (67 . 0) (8 . "S-Pipe-Length") (100 . "AcDbText") (10 0.0 0.0 0.0) (40 . 0.095833333333331) (1 . "-LENGTH-") (50 . 0.0) (41 . 0. (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 1) (100 . "AcDbAttributeDefinition") (280 . 0) (3 . "PIPE LENGTH:") (2 . "PIPELENGTH") (70 . 0) (74 . 3) (280 . 0) ) ) (entmake '((0 . "ATTDEF") (100 . "AcDbEntity") (67 . 0) (8 . "S-Pipe-Cut") (100 . "AcDbText") (10 0.0 0.0 0.0) (40 . 0.095833333333331) (1 . "-LENGTH-") (50 . 0.0) (41 . 0. (51 . 0.0) (7 . "Standard") (71 . 0) (72 . 1) (100 . "AcDbAttributeDefinition") (280 . 0) (3 . "CUT LENGTH:") (2 . "CUTLENGTH") (70 . 0) (74 . 3) (280 . 0) ) ) (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) (princ) ) ; end DEF_PipeDetail ;;;======================== Insert Block ====================== (defun insert_PipeDetail (p lay rot d_lay pl_lay cl_lay font value1 value2 value3) (entmake (list (cons 0 "INSERT") (cons 2 "PipeDetail") (cons 10 p) (cons 8 lay) (cons 66 1) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER") (cons 50 rot);block rotation (radians) ) ) (entmake (list (cons 0 "ATTRIB") (cons 8 d_lay) (cons 10 (mapcar '* (mapcar '+ p '(0.0 0.046875 0.0)) (list (getvar "textsize")(getvar "textsize")(getvar "textsize")))) (cons 11 (mapcar '+ p '(0.0 0.140625 0.0))) (cons 40 (getvar "textsize"));text height (cons 1 Value1) (cons 2 "DIA") (cons 70 0);attr flag (cons 50 0);text rot (cons 41 1);relative x-factor, width ;;; (cons 51 0);oblique angle (default 0) (cons 7 font) ;;; (cons 71 0);text flag (def 0, bkwrd 2, upside dn 4) (cons 74 1);1 BCenter (cons 72 1);1 Center (cons 210 (list 0 0 1));extrusion (def 0,0,1) ;;; (cons 73 0) (cons 62 256);color (bylayer 256) ;;; (cons 39 0);thickness (def 0) (cons 6 "BYLAYER") ) ) (entmake (list (cons 0 "ATTRIB") (cons 8 pl_lay) (cons 10 (mapcar '* (mapcar '+ p '(-0.046875 -0.140625 0.0)) (list (getvar "textsize")(getvar "textsize")(getvar "textsize")))) (cons 11 (mapcar '+ p '(-0.046875 -0.140625 0.0))) (cons 40 (getvar "textsize"));text height (cons 1 Value2) (cons 2 "PIPELENGTH") (cons 70 0);attr flag (cons 50 0);text rot (cons 41 1);relative x-factor, width ;;; (cons 51 0);oblique angle (default 0) (cons 7 font) ;;; (cons 71 0);text flag (def 0, bkwrd 2, upside dn 4) (cons 74 3);3 TCenter (cons 72 1);1 Center (cons 210 (list 0 0 1));extrusion (def 0,0,1) ;;; (cons 73 0) (cons 62 256);color (bylayer 256) ;;; (cons 39 0);thickness (def 0) (cons 6 "BYLAYER");linetype name ) ) (entmake (list (cons 0 "ATTRIB") (cons 8 cl_lay) (cons 10 (mapcar '* (mapcar '+ p '(0.046875 -0.28125 0.0)) (list (getvar "textsize")(getvar "textsize")(getvar "textsize")))) (cons 11 (mapcar '+ p '(0.046875 -0.28125 0.0))) (cons 40 (getvar "textsize"));text height (cons 1 Value3) (cons 2 "CUTLENGTH") (cons 70 0);attr flag (cons 50 0);text rot (cons 41 1);relative x-factor, width ;;; (cons 51 0);oblique angle (default 0) (cons 7 font) ;;; (cons 71 0);text flag (def 0, bkwrd 2, upside dn 4) (cons 74 3);3 TCenter (cons 72 1);1 Center (cons 210 (list 0 0 1));extrusion (def 0,0,1) ;;; (cons 73 0) (cons 62 256);color (bylayer 256) ;;; (cons 39 0);thickness (def 0) (cons 6 "BYLAYER");linetype name ) ) (entmake (list (cons 0 "SEQEND") (cons 8 lay) ) ) ) ;;;======================== Make Layers ====================== (defun make_layer (MyLayer MyColor MyLtype) (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 MyLayer) (cons 6 MyLtype) (cons 62 MyColor) (cons 70 0) ) ) ) ;;;======================== Main Function ======================= (if (not (tblsearch "layer" LAY1)) (make_layer LAY1 CLR1 LTP1) ) (if (not (tblsearch "layer" LAY2)) (make_layer LAY2 CLR2 LTP2) ) (if (not (tblsearch "layer" LAY3)) (make_layer LAY3 CLR3 LTP3) ) (if (not (tblsearch "layer" LAY4)) (make_layer LAY4 CLR4 LTP4) ) (if (not (tblsearch "block" "PipeDetail")) (DEF_PipeDetail) ) ;;; temporary setq (setq value1 "MyDiameter" value2 "MyLength" value3 "MyCut" rotation 1.5708 ) ;;; end temporary setq (setvar "osmode" 512) (while (setq p (getpoint "\nPick insertion point >> ")) (insert_PipeDetail p LAY1 rotation LAY2 LAY3 LAY4 FONT value1 value2 value3) ) ;;;end while (princ) ) This code works, but I cannot get the lower two attributes to offset from the line (by half the text height), nor can I get the entire block to rotate (I used rotation 1.5708, or 90 degrees). If anyone can enlighten me, or kick me in the right direction it would be much appreciated. Thanks, CHL
  2. I have a rectangular device tag with polylines as wires. I want to rotate the wires, but since the device is rectangular, I end up with spaces at 90 and 180 degrees. Any suggestions would be greatly appreciated. Motion Detector.dwg
  3. Hi i have a plate and a shaft. i am able to constraint the shaft to be tangent to the plate and constraint it to be on a specified location. However. i need to make the plate rotate when the shaft rotates as if it is one unit. the shaft is to be welded to the plate. i tried everything within the joint or constraint. i also tried to weld the plate and shaft as single assembly but i couldn't weld with the shaft tangent with 0 offset. all i need is to fix the shaft on the plate and make the plate rotate with the shaft.
  4. sanju2323

    text rotation

    i am trying to rotate text at zero angle but it is not work. please see attachment drawing and please give me lisp to set text zero rotation. Rotate text Set Zero Angle.dwg
  5. GregD

    CAD LT 2013 Block Authoring

    Hi, It's a bit difficult to explain my problem I would like to know how (or if it's even possible) to have an object follow a block in rotation (authored) without the object rotating itself. Kind of like a piston in a car, the piston will only move up and down but the rod and crankshaft will be in rotation (good example I hope). Or a luffing crane hoisting up and down and the counter ballast will follow the line of rotation but not rotate itself... Help would me much appreciated. Thanks.
  6. Good evening. After some extensive reasearch I could not find a way to solve my problem, so I have come here hoping you guys can save me yet again. I've spent the past three days trying to create this block and at the moment I'm quite frustrated. I'm trying to create a dynamic block with multiple actions. I need a flip, a stretch, a visibility and a rotation parameter and a basepoint. Everything works just fine until I add the rotation action. I need certain entities to rotate but the text to remain at 0 degrees. I learned that you can do that by assigning point parameter to move the text and then include only the point parameter in the rotate action selection set. The problem happens when I try to do that and also add a basepoint. With the basepoint the behaviour of the attributes (or text entities) becomes erratic. Sometimes they even spin in an opposite direction when compared to the other entities. I don't know why that is happening. If I do not include a basepoint explicitly AutoCAD automatically creates a grip that works as a basepoint. In this case the rotation of the attributes and the other entities works just fine, but the new basepoint grip is left behind when I use the rotate action. I have attached a file containing three slightly different blocks. The first one is without any tinkering; on the second one I made the rotation action "Independent" (sometimes that helps, but it didn't work here); on the third one I deleted the explicit basepoint and you will notice the behaviour I described above. I thank you all in advance for your time and expertise. FlagBlocks.dwg
  7. smashmash

    Rotation about an axis?

    I'm sure my beginner is showing, but I'm not sure how to constrain something to allow it to rotate about an axis. Basically, I have an axle which is grounded, and I need a wheel assembly to freely rotate about the axle. Any help would be GREATLY appreciated!
  8. Hi, I'm just trying my hand at learning to create some dynamic blocks, but need a solution to keep the text unrotated. I have attached a file of my troublesome file for you experts to look at, if possible. PileTest.dwg The file is basically a plan view of 4x foundation columns for overhead line towers (pylons). These towers can be different sizes and at different orientations, hence the dynamic options I have applied. However, when I rotate the block I want the text to rotate with it (to keep aligned with each column A, B, C, D), but I don't want rotation to be applied to the text, if that makes sense? Any ideas on the best way to achieve this? I have a feeling that constraints might work, although I know nothing about them, but these usually lag my PC. At present I am having to explode the block and apply a 0 rotation to all the text.
  9. First of all sorry for my bad english. I wonder how do I change the default value of the angle that is between in the command UCS "specify rotation angle about X axis :" from 180.00 to 90.00 Thanks
  10. I'd like to share something I just discovered. It may be old news to many of you. Select a dimension. Select the text grip. Right click. You'll get a menu for doing some neat things with the text, such as moving it independently, resetting it, and centering it vertically. You can even rotate the dimension. I was trying to move some dimension text because the plan doesn't line up with the UCS. Either the text was upside down (reading left to right) or on the wrong side of the line (reading right to left). This beats exploding the dimension!
  11. Hello all and thanks ahead of time for any guidance. To simply put it, I am grabbing linework from a dwg and copying it from base point 0,0,0. in the drawing that I want to copy it into, I hit ctrl+v and type 0,0,0 to put it exactly where it needs to be. For some reason, that I cannot figure out, the 0,0,0 point in the two drawings are different...so I have to zoom extents and hunt for it 10,000feet away in model space. But that is not the main problem because I can always find it and move it where it needs to be. The main problem is that when I move the copied linework over the previous linework that needs updated, it has been rotated like 3 - 4 degrees. That, or my base file's linework has been rotated 3 - 4 degrees - which doesn;t make sense because my base files linework is made up of xref's! All drawings are set to UCS World. Is there a way to make the 0,0,0 points the same location in both my base file and all the xrefs? I can kind of tell that my base file is not completely vertical when the xref dwg is...is there a setting that my base file has for xref's that is rotating them 3 - 4 degrees? Sorry if this is complicated...I am having this problem on several of my projects. I can explain more if I need to.
  12. I have a property line that is N 36d19'52" E but needs to be N 12d52'18" E. The obvious and calculated rotation angle would be 23d27'34" but when I rotate the line by the calculated angle it doesn't rotate to the right angle. It's off by 0d11'10"!? When I draw a line by bearing at N12d52'18" E and inquiry the angle between the property line and the drawn line the angle difference is in fact 23d27'34". Is there a setting I have selected that I don't know I selected. I am in US survey feet, degrees, dd.mmss.ss
  13. Hi, I am currently doing a series of drawings with multiple viewports across the same level. To fit them all on an A1 drawing, I have to orientate the viewports in different fashion. This means that the symbols (blocks) look different depending on the viewport rotation. Is there any way to make it so blocks are displayed with a Rotation of X (say, in this case, '0') on each viewport? Thank you in advance. Any help in this would be greatly appreciated! Regards, Chris
  14. Apologies if this has been posted already - been searching everywhere for an answer to this one! Here is the problem with the process put simply: Start with a new drawing Drawn a rectangle. Place a block which has an attribute with a number at each corner. ie. 1-4. Convert all objects into one single block. (the attributes become nested). If you use data extraction and retrieve the attribute number, position X and position Y, and output to a table the information displayed is correct. HOWEVER, if you rotate the block and update the link the coordinates become incorrect? This seems to be an issue with nested blocks?
  15. I'm working with rotating wheels and am trying to figure out how I can go from 60 rpm to 30 rpm with no stop?
  16. I'm trying to animate the wheels on this crane (not as important as the later wheels I'm drawing up right now) and I can't get a full rotation. I tried everything to my understanding to use motion transition constraints against the rail or manually rotate them in the Studio. The former never worked for me and later keeps rotation 180 clockwise, then 180 ccw, and back and forth. Can anybody explain what I need to fix? I started a fresh document with no joints for I figure I must have been screwing up on that. If anyone can, please take a look at the files and see if he or she can solve this drafting quarrel. https://docs.google.com/open?id=0B1StefGFfwrxNER3OU5vbDlUWXlsZmI0bnpCdzR1Zw Thanks for the help!
  17. My company recently hired out some AutoCAD work. The task they completed was to load our drawings from pre-CAD days (1970s and 80s) into AutoCAD and update them with new piping and notes. Somehow, when they did this, the drawings in model space ended up sideways, but they are right-side-up in paper space. This is making it very difficult to work with the drawing in model space. A simple rotation of the entire model space drawing does not solve the problem because the xref files are correctly oriented, and they do not rotate with the added notes, etc. Also, it does not work to rotate just the notes and realign the leaders because then the drawing ends up sideways in paper space. There must be some way to fix this, I just can't seem to figure out how. Help? Thanks!
  18. Hi I think this is a simple question for you guys but how do you find the rotation of a block within a drawing that I know the name. I want to create a new USC that is at the same rotation. I have tried Associated List 50 but there does not seem to be a rotation angle in that list is there some way to look into the properties and draw a rotation angle for there Here is a the code I tried [font=Tahoma][font=Tahoma](setq vfrt (assoc 50 (entsel "a3m_MS_viewframe_01000")))[/font] [/font]
  19. Ok. So I'm using a lisp routine that has been previously set up. It wouldn't display any of the current UCS coordinates. I think I fixed that. But now, I have caused a problem with the leaders. Specifically the line that is supposed to go underneath the N but above the easting. In WCS it works out just fine, but in the UCS it shoots off up and right. usually based on how far I am from the World Origin. Help! Below is the code. (Sadly I don't know exactly where the problem is) Main Function--------------------------------------------------------------------------- ;;;Function draws a leader with no text. (defun bmcdNE (wLeader wElev wa / ap np ep N E) (BMCDTextStyles) ;load standard text styles (BMCDDimStyles) ;load standard dim styles ;save variables (NEsave-vars) ; setup error handler here (setvar "cmdecho" 0) (setq *error* leader-error) ;check and set dscale (if (= dscale nil) (setq dscale (getvar "dimscale")) );end if (QlSave);saves current settings ;Now we need to set the current settings for the needed leader (setq NoText '(4 ;1. AnnoType 60 0Mtext<def> 1Copy 2Tolerance 3BlockReference 4None 0 ;2. ReuseAnno 61 0None<def> 1Next 2Current 1 ;3. LeftAttach 62 0TopOfTop 1MiddleOfTop<def> 2Middle 3MiddleOfBottom 4BottomOfBottom 3 ;4. RightAttach 63 0TopOfTop 1MiddleOfTop 2Middle 3MiddleOfBottom<def> 4BottomOfBottom 0 ;5. Underline 64 1On 0Off<def> 0 ;6. Splined 65 1On 0Off<def> 1 ;7. NoPointLimit 66 1On 0Off<def> 2 ;8. NumPoints 67 Integer (Must be greater than 2) 3<def> 0 ;9. Wordwrap 68 1On<def> 0Off 1 ;10. AlwaysLeftJust 69 1On 0Off<def> 0 ;11. Angle1 70 0Any<def> 1Horizontal 2?d 3Ed 40d 5 d 0 ;12. Angle2 71 0Any<def> 1Horizontal 2?d 3Ed 40d 5 d 0 ;13. Box 72 1On 0Off<def> 0.0 ;14. Textwidth 40 Real (Must be > 0.0) 0.0<def> "." ;15. Arrowname 3 String (or User defined arrow as block name) See definitions below ));end setq (command "osnap" "end,mid,intersection,center") (SetQleader NoText) (setvar "dimlwd" -1) (setvar "texteval" 1) (setvar "orthomode" 0) (setq style (cdr(assoc 40 (tblsearch "style" (getvar "textstyle"))))) ;gets the text height from style. (setq comp (cdr(assoc 41 (tblsearch "style" (getvar "textstyle"))))) ;stores the compression factor. (if (= 0 style) (setq ts (getvar "textsize"))) ;sets the text size to the active textsize. (if (/= 0 style) (setq ts style)) ;sets the text size to the style size. (command "layer" "set" "G-ANNO-TEXT" "") (setq pt1 (getpoint "\nEnter starting point:")) ;Gets the first point for the ;coordinate and line. (setvar "osmode" 0) (setvar "luprec" 2) (setq save-pt1 pt1) ;;; ;do we need to covert the point from pspace to mspace? (if (= (getvar "tilemode") 0) (setq cs_from 0) ;WCS (setq cs_to 1) ;UCS (setq pt1 (trans pt cs_from cs_to 0) ; disp = 0 indicateds that pt is a point ) (setq x1 (car pt1)) ;Stores the x coord of the first point. (setq y1 (cadr pt1)) ;Stores the y coord of the first point. (setq z1 (caddr pt1)) ;stores the z coord of the first point. JAH (setq xabs (abs x1)) ;Gets the absolute value of the x point. (setq yabs (abs y1)) ;Gets the absolute value of the y point. (setq zabs (abs z1)) ;Gets the absolute value of the z point. AMS (setq x (rtos xabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the x coord from real to string. (setq y (rtos yabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the y coord form real to string. (setq z (rtos zabs (getvar "lunits") (+(getvar "luprec")0))) ;Converts the z coord form real to string. JAH ;if the number of decimal places is less than the precission add zeros (while (< (strlen (substr x (+(vl-string-search "." x) 2))) (getvar "luprec")) (setq x (strcat x "0")) ) ;if the number of decimal places is less than the precission add zeros (while (< (strlen (substr y (+(vl-string-search "." y) 2))) (getvar "luprec")) (setq y (strcat y "0")) ) ;if the number of decimal places is less than the precission add zeros (while (< (strlen (substr z (+(vl-string-search "." z) 2))) (getvar "luprec")) (setq z (strcat z "0")) ) (setq IN x) ;Sets variable for subroutine. (COMMA) ;CALLS SUBROUTINE. (setq x OUT) ;Saves variable from subroutine. (setq IN y) ;Sets variable for subroutine. (COMMA) ;CALLS SUBROUTINE. (setq y OUT) ;Saves variable from subroutine. (setq IN z) ;Sets variable for subroutine. (COMMA) ;CALLS SUBROUTINE. (setq z OUT) ;Saves variable from subroutine. (setq pt1 save-pt1 ) (if (> X1 0) (setq E (strcat "E " x )) ;Checks to see if X coordinate ) (if(< X1 0) (setq E (strcat "W " x )) ;is positive or negitive ) (if(= X1 0) (setq E (strcat "BASELINE " x )) ;and sets the proper label. ) (if(> Y1 0) (setq N (strcat "N " y )) ;Checks to see if Y coordinate ) (if(< Y1 0) (setq N (strcat "S " y )) ;is positive or negitive ) (if(= Y1 0) (setq N (strcat "BASELINE " y )) ;and sets the proper label. ) (setq ABC "ABC ") ;;;build the elevation label (setq Zelev (strcat "EL " z)) (setq nl (strlen N)) ;Gets the string length of the N variable. (setq el (strlen E)) ;Gets the string length of the E variable. (cond ((> nl el) (setq ll nl)) ;Tests to see if the N var is longer than ;the E var. ((> el nl) (setq ll el)) ;Tests to see if the E var is longer than ;the N var. ((= nl el) (setq ll nl)) ;Tests to see if the N and E var are equil. ) ;end cond (setq pt2 (getpoint pt1 "\nEnter second point:")) ;The pt1 is used to create ;a rubberband line. (grdraw pt1 pt2 -1) ;Draws a tempory line to let you see ;where you are and what is going on. (setq x2 (car pt2)) ;Stores the Second X point (setq y2 (cadr pt2)) ;Stores the Second Y point (setq pt3 (getpoint pt2 "Enter side to offset:")) ;The pt2 is used to create ;a rubberband line. (setq x3 (car pt3)) ;Stores the Third X point (setq y3 (cadr pt3)) ;Stores the Third Y point (cond ((> x2 x3) (setq lx (- x2 (* 0.8 ts ll comp)))) ;Checks to see wich way ((> x3 x2) (setq lx (+ x2 (* 0.8 ts ll comp)))) ;you are drawing the line ) ;and sets the end of line ;to match the text length. (cond ((> x2 x3) (setq tx lx)) ;Based on the direction of the line ((> x3 x2) (setq tx (+ x2 ts))) ;the text X point is calculated. ) (setq ta (+ y2 (* ts 3))) (setq ap (list tx ta)) (setq tn (+ y2 ts)) ;Calculates the Y point for North or South text. (setq np (list tx tn)) ;Creates the point to place the text. (setq te (- y2 ts )) ;Calculates the Y point for East or West test. (setq ep (list tx te)) ;Creates the point to place the text. (setq tElev (- y2 (* ts 3))) ;Calculates the Y point for Elevation text. (setq elevP (list tx tElev)) ;Creates the point to place the text. (setq ly y2) ;Sets the last Y point EQ. to the second Y point. (setq pt4 (list lx ly)) ;Creates the point for the end of the line. (command "pline" pt2 pt4 "") ;Places the line. (setq theline (vlax-ename->vla-object (entlast))) ;get the line object (if (= style 0) (command "text" "J" "ML" np ts "0" N)) ;Places the top text. (if (/= style 0) (command "text" "J" "ML" np "0" N)) ;Places the top text. (setq toptext (vlax-ename->vla-object (entlast))) ;get the text object (if (= style 0) (command "text" "J" "ML" ep ts "0" E)) ;Places the bottom text. (if (/= style 0) (command "text" "J" "ML" ep "0" E)) ;Places the bottom text. (setq bottomtext (vlax-ename->vla-object (entlast))) ;get the text object (if wa (progn (if (= style 0) (command "text" "J" "ML" ap ts "0" ABC)) (if (/= style 0) (command "text" "J" "ML" ap "0" ABC)) (setq atext (vlax-ename->vla-object (entlast))) ) ) ;;;Create the text for the elevation text (if wElev (progn (if (= style 0) (command "text" "J" "ML" elevP ts "0" Zelev)) ;Places the bottom text. (if (/= style 0) (command "text" "J" "ML" elevP "0" Zelev)) ;Places the bottom text. (setq Elevtext (vlax-ename->vla-object (entlast))) ;get the text object );end progn );end if ;rotate the text and line to make it horizontal (setq viewrotation (getvar "viewtwist")) ;ucs twist (setq retval (vla-rotate theline (vlax-3d-point pt2) (* viewrotation -1))) (setq retval (vla-rotate toptext (vlax-3d-point pt2) (* viewrotation -1))) (setq retval (vla-rotate bottomtext (vlax-3d-point pt2) (* viewrotation -1))) (if wa (setq retval (vla-rotate atext (vlax-3d-point pt2) (* viewrotation -1))) ) (if wElev (setq retval (vla-rotate Elevtext (vlax-3d-point pt2) (* viewrotation -1))) );end if ;;;get the end point of the now rotated line this will also be the endpoint for the qleader (setq theLineCoords (vlax-variant-value (vla-get-Coordinates theline))) (setq newXPt (vlax-safearray-get-element theLineCoords 0)) (setq newYPt (vlax-safearray-get-element theLineCoords 0)) (setq newEndPt (list newXPt newYPt)) ;in order to avoid the the mtext dialog we set the default qleader settings above (setq ss (ssget "_X" (list (cons 0 "*MTEXT,TEXT")(cons 1 "Ex. TP*")))) (if wLeader (progn (vl-cmdf "qleader" pt1 pt2 newEndPt "") (vla-delete theline) ;delete our temp line );end progn );end if (Merge) (QlRestore) (setvar "cmdecho" 1) ;Turns on the command echo. (redraw) (NErestore-vars) (princ) );end defun (defun c:LNE () (bmcdNE T nil nil) (princ) );end defun (defun c:LNEL () (bmcdNE T nil T) (princ) );end defun (defun c:LNEEL () (bmcdNE T T T) (princ) );end defun (defun c:LNEE () (bmcdNE T T nil) (princ) );end defun (defun c:NEE () (bmcdNE nil T nil) (princ) );end defun (defun c:NEEL () (bmcdNE nil T T) (princ) );end defun (defun c:NEL () (bmcdNE nil nil T) (princ) );end defun (defun c:NE () (bmcdNE nil nil nil) (princ) );end defun I am using "lneel" as my command.
  • Create New...