Jump to content

Search the Community

Showing results for tags 'rectangle'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 24 results

  1. Hey Guys, I found some old posts from 2010 asking about the Rectangle function with SNAPANG. Is this possible in AutoCad 2022? Seems kinda basic to me to at least have the option for this
  2. Hi, I want to check for the width and height of a Rectangle. I got this code (defun getRect () (if (setq rec (ssget "_X" (list '(0 . "LWPOLYLINE") '(8 . "LAYOUT") '(90 . 4) (cons 410 (getvar "ctab")) ))) (progn (setq e (ssname rec 0)) (setq coords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget e)))) (setq height (distance (car coords) (nth 3 coords))) (setq width (distance (car coords) (nth 1 coords))) (if (= height 594.0) T (princ height) ) ) ) (princ) ) If I check for the Width it works and it returns T But If I try to get the height it returns false and prints 594.0 Why does this not return True as well?
  3. I'm modeling a dynamic block. It represent a simple floor plan chimney. The dynamic block has six stretch actions. Three stretch actions are displayed in the properties menu. Two strectch actions have grip points. The total width and length. Tree stretch actions are chaind. They stretch with the wall thickness action. Unfortunately they won't move equal. Drawing1.dwg
  4. hello, I'm frequently placing metal anchors for foundations. To do this i align those on the center lines. I've found a LISP what does what i need, creating the center lines of the rectangles. Can i add some code so i can select multiple polylines? Thanks in advance. CenterCross.lsp
  5. Hai all, i have a lisp that gives me Length and Width of Rectangles that i select into a Table in cad. the table gives me the length and width as per incremental in size (eg:{ 1x2, 1.2x2, 2.1x3 } like wise) i have attached a screenshot of this, and also joins same size rectangle in one cell and shows number as 2. What i need help is to get the table not as incremental values but as i select (1st selection in first cell, 2nd in second cell like that). Please check the Screen shot. i don't know how to change the codes, the lisp is from a friend i got. so please help if possible , thanks in advance.. Please check the image ive uploaded too. the lisp code: (defun rectangle_dims (e / l a b) (setq l (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) e))) (if (and (or (= 1 (logand (cdr (assoc 70 e)) 1)) (equal (car l) (last l) 1e-8) ) (equal (distance (car l) (caddr l)) (distance (cadr l) (cadddr l)) 1e-8) (equal (mapcar '- (cadr l) (car l)) (mapcar '- (caddr l) (cadddr l)) 1e-8) (equal (mapcar '- (caddr l) (cadr l)) (mapcar '- (cadddr l) (car l)) 1e-8) ) (vl-sort (list (distance (car l) (cadr l)) (distance (cadr l) (caddr l))) '<) ) ) (defun C:RECDIMS (/ acObj acDoc space *error* ss e old r p1) (vl-load-com) (setq acObj (vlax-get-acad-object) acDoc (vla-get-activedocument acObj) space (vlax-get acDoc (if (= 1 (getvar 'cvport)) 'PaperSpace 'ModelSpace)) ) (vla-startundomark acDoc) ;;;;;; Error function ;;;;;;;;; (defun *error* (msg) (and msg (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*BREAK*")) (princ (strcat "\nError: " msg)) ) (vla-endundomark acDoc) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (if (setq ss (ssget '((0 . "LWPOLYLINE") (-4 . "<OR") (90 . 4) (90 . 5) (-4 . "OR>")))) (progn (repeat (setq i (sslength ss)) (setq e (ssname ss (setq i (1- i)))) (if (setq dims (rectangle_dims (entget e))) (if (setq old (vl-some '(lambda (d) (if (equal (list (cadr d) (caddr d)) dims 1e-8) d)) r)) (setq r (subst (cons (1+ (car old)) dims) old r)) (setq r (cons (cons 1 dims) r)) ) ) ) (if (and r (setq p1 (getpoint "\nSpecify table insert point: "))) (insert_table (mapcar '(lambda (a) (list (cadr a) (caddr a) (car a)) ) (vl-sort (vl-sort r '(lambda (a b) (< (caddr a) (caddr b)))) '(lambda (a b) (< (cadr a) (cadr b)))) ) p1 ) ) ) ) (princ) ) ;;The textheight in table depends on cannonscale (defun insert_table (lst pct / tab row col ht i n) (setq ht (/ 2.5 (getvar 'cannoscalevalue)) pct (trans pct 1 0) n (trans '(1 0 0) 1 0 T) tab (setq tab (vla-addtable space (vlax-3d-point pct) (+ 2 (length lst)) (length (car lst)) (* 2.5 ht) ht)) ) (vlax-put tab 'direction n) (mapcar (function (lambda (rowType) (vla-SetTextStyle tab rowType (getvar 'textstyle)) (vla-SetTextHeight tab rowType ht) ) ) '(2 4 1) ) (vla-put-HorzCellMargin tab (* 0.14 ht)) (vla-put-VertCellMargin tab (* 0.14 ht)) (setq lst (cons '("Width" "Length" "Pcs.") lst)) (setq i 0) (foreach col (apply 'mapcar (cons 'list lst)) (vla-SetColumnWidth tab i (apply 'max (mapcar '(lambda (x) ((lambda (txb) (+ (abs (- (caadr txb) (caar txb))) (* 2.0 ht))) (textbox (list (cons 1 (vl-princ-to-string x)) (cons 7 (getvar 'textstyle)) (cons 40 ht))) ) ) col ) ) ) (setq i (1+ i)) ) (setq lst (cons '("RECTANGLES") lst)) (setq row 0) (foreach r lst (setq col 0) (vla-SetRowHeight tab row (* 1.5 ht)) (foreach c r (vla-SetText tab row col (vl-princ-to-string c)) (setq col (1+ col)) ) (setq row (1+ row)) ) ) (princ "\nType RECDIMS to start the command")
  6. 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
  7. 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
  8. 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
  9. Hello! Does anyone know a routine that enables provide real-time the sum of areas of rectangles as you draw consecutively?
  10. Hello Euclid's algorithm: tiling a rectangle (any size) with squares - Can this be done with lisp routine? Regards
  11. 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))
  12. 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!
  13. 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?
  14. 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.
  15. 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
  16. 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.
  17. 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!!!
  18. 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
  19. 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!
  20. 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
  21. 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.
  22. 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
  23. 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?
  24. 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?
×
×
  • Create New...