Jump to content

Search the Community

Showing results for tags 'rectangle'.

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

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

Found 19 results

  1. BrianTFC

    Text fit lisp

    Hi All, I was wondering if there was a lisp routine out there that when you drop a dtext string into a rectanlge that it would shrink down to fit inside? I looked at the text fit command in the express tools but it only shrinks or stretches the length. Thanks, Brian
  2. See screenshot of what my routine does. It creates new vports from closed LWpolylines and locks them. I just don't know how to do the same as this below. GIF of Routine: CODE: ;; ----------------------=={ VP_Clip_All_LWPS }==------------------------- ;; ----------------------------------------------------------------------- ;; AUTHOR & ADDITIONAL CODE ;; Author: 3dwannab, Copyright © 2018. ;; Error functions: LeeMac Help pages. www.lee-mac.com. ;; ABOUT / NOTES ;; Creates new VIEWPORT/s from existing closed LWPOLYLINE/s. ;; FUNCTION SYNTAX ;; Short-cut VP_CALLS ;; Long-cut VP_Clip_All_LWPS ;; VERSION DATE INFO ;; Version 1.0 27-07-2018 Initial release. ;; TO DO LIST ;; Increase the overall scale of the VIEWPORT from 1:20 to 1:2 for example. ;; ----------------------------------------------------------------------- ;; ------------------=={ VP_Clip_All_LWPS START }==----------------------- (defun c:---VP_Clip_All_LWPS (/) (progn (LOAD "VP_Clip_All_LWPS") (C:VP_Clip_All_LWPS))) (defun c:VP_CALLS () (c:VP_Clip_All_LWPS)) (defun c:VP_Clip_All_LWPS (/ ent_vp i ss_1 var_cmde var_os y ) (setq *error* LM:error) (LM:startundo) (setq var_cmde (getvar "cmdecho")) (setq var_os (getvar "osmode")) (setvar 'cmdecho 0) (setvar 'osmode 0) (cond ((> (getvar 'CVPORT) 1) (princ "\n ** Command not allowed in Model Tab ** ")) ( (while (not (and (setq ent_vp (car (entsel "\nPlease select 1 VIEWPORT,\nthen any closed LWPOLYLINES within to create\nnew VPs from\n: --------------------------------------------------------- :\n")) ent_vp_data (if ent_vp (entget ent_vp)) ) (= (cdr (assoc 0 ent_vp_data)) "VIEWPORT") (progn (if (setq ss_1 (ssget '((0 . "LWPOLYLINE") (-4 . "=") (70 . 1)))) (progn (command "_.vports" "_lock" "_on" ent_vp "") (command "_.copybase" '(0 0) ent_vp "") (entdel ent_vp) (repeat (setq i (sslength ss_1)) (command "_.pasteclip" "_non" '(0 0)) (setq ent_last (entlast)) (command "_.vpclip" ent_last (ssname ss_1 (setq i (1- i)))) ) (repeat (setq y (sslength ss_1)) (command "_.vpclip" (ssname ss_1 (setq y (1- y))) "_D") ) ) (progn (princ "\n*** Nothing Selected ***\n")(princ) ) ) ) ) ) (princ (strcat "\n >>> " (itoa (setq ss_1_len (sslength ss_1))) (if (> ss_1_len 1) " new viewports have been created" " new viewport has been created") " <<< \n")) ) ) ) (*error* nil)(princ) (princ) ) ;; ----------------------------------------------------------------------- ;; ---------------------=={ Functions START }==--------------------------- (vl-load-com) (defun LM:error (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>\n")) ) (setvar 'cmdecho var_cmde) (setvar 'osmode var_os) ) (princ) (defun LM:startundo () (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) ) (princ) ;; ----------------------------------------------------------------------- ;; -----------------------=={ Functions END }==-- ------------------------ (princ "\nVP_Clip_All_LWPS.lsp loaded | Version 1.0 | by 3dwannab.\n") (princ "\nType \"VP_Clip_All_LWPS\" OR \"VP_CALLS\" to run.\n") (princ) ;; ----------------------------------------------------------------------- ;; --------------------=={ VP_Clip_All_LWPS END }==----------------------- ;; EOL
  3. Dani_Nadir

    Coordinates LISP

    Hello, I am looking for the next lisp. I need to create a plline (for example a rectangle) wherever I want inside the model. Then, the routine will ask me about the distance between coordinate tic marks (x) , the plot scale (1/500 for example) and the height text. Then I will click the rectangle and finally it will create all the coordinate tick marks inside the rectangle as an editable objects (block for example) with its coordinates N (vertical) and E (horizontal). I am attaching a dwg Thanks, Best regards, Daniel. 1.dwg
  4. Hello! Does anyone know a routine that enables provide real-time the sum of areas of rectangles as you draw consecutively?
  5. Hello Euclid's algorithm: tiling a rectangle (any size) with squares - Can this be done with lisp routine? Regards
  6. I have written a little small command to run revision cloud on last object (i.e. rectangle, pline, circle...etc) and it works fine but I was trying to figure out a way to run that custom command after drawing my rectangle or pline. Instead of having to type the shortcut immediately after, every time. Here is custom rev cloud command I am referring to, this one works flawlessly when run as a standalone after I finish drawing said object that it will be used on but I would like to combine.. see below: (DEFUN C:RCL () (COMMAND "REVCLOUD" "O" "L" "") (COMMAND "-INSERT" "REV-TRI" PAUSE "" "" "") (COMMAND "EXPLODE" "L" "") (COMMAND "DDEDIT" "L" "") (PRINC)) Here is rectangle command with the attempt to run custom afterwards. It works but looks buggy and most likely written wrong. (take it easy ive been learning): (DEFUN C:RECL () (COMMAND "RECTANGLE" PAUSE PAUSE) (C:RCL) (PRINC)) Here is my attempt at the pline one but I dont even know where to start so it allows user unlimited points then hitting "c" for close afterwards AND THEN running the custom command: (DEFUN C:PLR () (command "_.PLINE") (coMmand pause) (C:RCL) (PRINC))
  7. I found this code on the web somewhere and it works great for a single line of text. I would like to be able to select multiple lines of text and have it do the same. To center several lines of text in an existing rectangle. I am hoping someone already has code to do this rather than hoping someone would code it for me. I am clueless on how to do this.. Many times what I encounter is multiple lines of individual text items. So it may be TEXT or it may be MTEXT. Here is the existing code which works great for a single line of text: ; PLACE TEXT AT THE CENTER OF A BOX OR A CIRCLE, ; IRRESPECTIVE OF TEXT'S INS.PT ; By G. Ramesh, NPCC, Abu Dhabi. (defun c:CTT(/ e el p1 p2 mid tb sp ll ur mid1 dis) (Princ "\nCenter Text in Box. ") (setvar "cmdecho" 0) (setq e (car(entsel "\nPick the text: ")) el (entget e)) (initget "Window Circle") (setq opt (getkword "\nTo be enclosed within a Window/Circle <W>: ")) (if (or (not opt) (= opt "WINDOW")) (setq p1 (getpoint "\nFirst corner of the enclosing box: ") p2 (getcorner p1 "\nOther corner: ") mid (polar p1 (angle p1 p2) (/ (distance p1 p2) 2)) ) (setq mid (cdr(assoc 10 (entget(car(entsel "\nSelect a CIRCLE: ")))))) ) (setq tb (textbox el) sp (cdr(assoc 10 el)) ll (mapcar '+ (car tb) sp) ur (mapcar '+ ll (mapcar '- (cadr tb) (car tb))) mid1 (polar ll (angle ll ur) (/ (distance ll ur) 2.0)) dis (mapcar '- mid mid1) ) (command ".move" e "" dis "") (prin1) ) Apologies for the formatting being all wonky, it was like that... Thanks much!
  8. I have drawn a rectangle, using the rectangle command. Now I want to enlarge it only in one edge. I wanted to use those small squares (Don't remember their name), however I find out that there is no middle square to move one edge. It only moves the corner and shape become un rectangle. The only way I find is, to explode to lines, move one line and extend other two edges, which is not a clever solution. 1) 1 What do you suggest? 2) 2 Is there any way to show those small rectangles in the middle of the rectangle?
  9. Hey guys, I'm trying to get the four corners of a rectangle in modelspace set to variables and I'm having a hard time with it. I'm able to get the four corners into a list, but I'm having a hard time setting each coordinate to a variable. The issue I'm having at this point is that the second variable duplicates the coordinate values. The first variable Here's what I got so far... (defun c:test (/ ptlist x y) (setq ptlist (massoc 10 (entget(car(entsel))))) (defun c:massoc (key alist / x nlist) (foreach x alist (if (eq key (car x)) (setq nlist (cons (cdr x) nlist)) ) ) (reverse nlist) ) ;end (princ ptlist) (setq x (car ptlist)) (setq y (cadr ptlist)) (princ) (princ x) (Princ) (princ y) ) I got part of this code from here When I draw in a rectangle in modelspace and I use this code, this is what I'm getting. Command: TEST Select object: ((18.2488 -11.0958) (23.6419 -11.0958) (23.6419 -5.32136) (18.2488 -5.32136))(18.2488 -11.0958)(23.6419 -11.0958)(23.6419 -11.0958) So it builds the list and sets the first variable right, but it duplicates the second. Thanks in advance! e: I haven't added in error trapping yet, just trying to figure this out first.
  10. Hi All, I'm having a little trouble figuring out how to center my text in the middle of the rectangle after its created. Here's what I have so far, it works but it waits for me to place it. Also I do a lot of panels that are the same size so I also want the lisp to remember the last input so I can continue to use it until I hit escape or return. If I could get some help I would appreciate it. (defun C:CRP7() (setq cmdold (getvar "cmdecho")) (setvar "cmdecho" 0) (setq PL (getstring "Enter a Panel Label :")) (setq PA (getpoint "Select Panel Area :")) (command "-boundary" "Advanced" "Island" "No" "Nearest" "" pa "") (command "_.change" (entlast) "" "_p" "_la" "Router - Green - V groove" "") (setq ts(getvar "textsize")) (setq tsty(getvar "textstyle")) (if(= 0 (cdr(assoc 40(tblsearch "style" tsty)))) (progn (command "text" "Justify" "Center" pa ts 0 PL))) (setvar "cmdecho" cmdold) (princ) ) Thanks Brian
  11. I don't really have problem with using rectangle command but on this drawing, when i drew the rectangle, i specified the first corner and second corner then i didn't get the closed rectagle as i used to have in the past, i still can't figure it out what happened. However i could type C for CLOSE to complete the rectangle but i didn't have to do that in the past. when opened new blank autocad the rectangle command works just fine. appreciate any suggestion.
  12. Hi everyone, I ran into a weird issue when I tried to create a rectangle off of a base point. Whenever I type in the x and y coordinates, a rectangle is created however the coordinate i typed in is now the end point and the rest of the rectangle extends to the bottom left of my screen and is beyond my zoom extent. I can create a rectangle using just the x coordinate off of a base point but it seems like the y coordinate is screwing everything up. Has anyone ran into this type of issue before? I was able to create rectangles all night using a base point but for some reason this issue just started happening to me. Thank you!!!
  13. Hi folks. What I am trying to do is something very basic: drawing a rectangle. But apparently autoCAD is acting up and wouldn't let me draw it. After clicking the rectangle button located at the top, I tried to draw a rectangle in the sketch area and this is what I got. Any input on the matter, other than restarting AutoCAD, would be appreciated. Thanks
  14. Hello! I was wondering how I would go about writing a function that would calculate the length of a diagonal of a rectangle using SQRT function? I've been trying but so far nothing! Thanks!
  15. Hi Forum, First of all, I know this is a well discussed topic and still: Please dont blame me for not using the search function or the helpfile - honestly: I tried it all and thorough. Im at Autocad 2012. When I start drawing a line from a specific point in the drawing and type in the dimensions via DYN - relative coordinates work like a charm, but when I start a rectangle from the same point and type in the dimensions (via DYN) it wont work. It does not change when I set dynpicoords to 0 or 1. Nothing else happens when I type @ or # or nothing as prefix. I guess there is either a solution or an easy explanation for this. I would be highly thankful, if someone can help me. Thanks in advance for reading and thinking. Cheers Pete
  16. khoshravan

    rectangle not included in filter

    I am trying to select a rectangle in a filter definition. However in the selection box I couldn't find the rectangle. What is wrong with my steps.
  17. Hi All, Here is what i'm looking for a lisp routine that when i copy rectanlges that are spaced 1/2" or so a part that when i place the copy back into the drawing it spreads them apart 24" or so. thanks, Brian
  18. I want to achieve exactly the same thing as shown in this video http://www.youtube.com/watch?v=0hlLIkXxIxk&feature=related I did as instructed and confirmed that I want to transform it to a mesh. But as I proceed and push the Smooth Object button, I receive the following message: ‘A smooth mesh cannot be created from at least one of the selected objects. Smooth meshes can be created only from 3D solids, 3D surfaces, 3D faces, polygon meshes, polyface meshes, regions, and closed polylines.’ Any ideas, which step I ignored?
  19. khoshravan

    How can I draw square rapidly

    I want to draw a square with a line as its side given. I am looking for a rapid solution, like pressing shift while using rectangle command to make two sides equal. Is there any such a short cut for square?