Jump to content

Search the Community

Showing results for tags 'autolisp;'.

  • 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 6 results

  1. Autolisp to hatch between two plines with different layers (layer1 and layer2 for example). When layer1 is above hatch the area in red, and when layer2 is above hatch in green. Actually I need this to calculate the area of cutt and fill in road cross sections
  2. JuniorNogueira

    Help editing a LISP

    Hi all, I would like some AutoLISP Expert to give me some advice and if possible help to edit the following LISP. the first .LSP makes several rectangles to parti of 3 posts and works perfectly !! until some adjustments that were made to get the second .LSP, the problem is precisely that. this .LSP has several problems the first is that it loses the essence of the first, the rectangles made from it, depending on the so that the points P1 P2 P3 are picked up, the rectangles are incorrectly made, also if the units of measure, are changed the program has some bugs, I also think the program is kinda heavy, it crashes every time we run the program. if these problems were solved it would already be PERFECT. but we will correct some more problems and if it were possible I would like to make some improvements. I would like the rectangle of the "LAND" to be in the "CYAN" color and all others in the "RED" color. 2º the "CYAN" rectangle Stay on layer "01" and the "RED" rectangles stay on layer "02". 3 and the labels inside the rectangles ("00" "00 * blue color" "Construction" "Terrain") lay on layers 03 04 05 06 in the exact color of the label. 4th after all the rectangles I will explode and would like it to be in the layers mentioned above. Thanks in advance for your help, and apologies for English, I live in Brazil and the translator does not translate correctly. ///////////////////////////// LISP 01 ///////////////////////////// (defun c:Subdivide ( / *error* vars vals p1 p2 p3 p4 ang n w) (gc) (vl-load-com) (or *acad* (setq *acad* (vlax-get-acad-object))) (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*))) (defun *error* (error) (mapcar 'setvar vars vals) (vla-endundomark *doc*) (cond ((not error)) ((wcmatch (strcase error) "*QUIT*,*CANCEL*")) (1 (princ (strcat "\nERROR: " error))) ) (princ) ) (vla-endundomark *doc*) (vla-startundomark *doc*) (setq vars '("cmdecho" "osmode")) (setq vals (mapcar 'getvar vars)) (mapcar 'setvar vars '(0 0)) (command "_.expert" (getvar "expert")) ;; dummy command (and (setq p1 (getpoint "\nP1 <Início da Edificação>: ")) (setq p2 (getpoint p1 "\nP2 <Comprimento da Edificação>: ")) (setq p3 (getpoint p2 "\nP3 <Comprimento da Quadra>: ")) (or (not (equal (angle p1 p2)(angle p1 p3) 1e-4)) (alert "\nPoints are all in a straight line.") ) (not (initget 7)) (setq n (getint "\nEnter quantity of parcels to create: ")) (setq ang (angle p2 p3)) (setq w (/ (distance p2 p3) n)) (repeat n (setq p3 (polar p2 ang w) p4 (polar p1 ang w) ) (vl-cmdf "_.pline" p2 p3 p4 p1 "_C") (setq p2 p3 p1 p4) ) ) (*error* nil) ) (defun c:SD ()(c:Subdivide)) ///////////////////////////// LISP 02 ///////////////////////////// (defun c:Subdivide( / *error* bmakerec3vs vars vals ucsf p1 p2 p3 k n w h bnn ) (gc) (vl-load-com) (or *acad* (setq *acad* (vlax-get-acad-object))) (or *doc* (setq *doc* (vla-get-ActiveDocument *acad*))) (defun *error* ( error ) (mapcar 'setvar vars vals) (if ucsf (command-s "_.UCS" "_P") ) (vla-endundomark *doc*) (cond ((not error)) ((wcmatch (strcase error) "*QUIT*,*CANCEL*")) (1 (princ (strcat "\nERROR: " error))) ) (princ) ) (defun bmakerec3vs ( w h ts bn / p ss ) (setq ss (ssadd)) (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h)) (ssadd (entlast) ss) (setq p (list (/ w 4.0) (/ h 2.0))) (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "00") (ssadd (entlast) ss) (vl-cmdf "_.BLOCK" bn '(0.0 0.0) ss) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (if (or (not (entlast)) (and (entlast) (not (ssmemb (entlast) ss)))) (progn (vl-cmdf "_.INSERT" bn '(0.0 0.0)) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) ) ) (vl-cmdf "_.BEDIT" bn) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.CHANGE" "_ALL" "" "_P" "_C" "3") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.BPARAMETER" "_V" p) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.-BVSTATE" "_N" "Edificações" "_C") (vl-cmdf "_.-BVSTATE" "_D" "VisibilityState0") (vl-cmdf "_.-BVSTATE" "_N" "Construções" "_H") (setq ss (ssadd)) (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h)) (ssadd (entlast) ss) (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "Construção") (ssadd (entlast) ss) (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "2") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.-BVSTATE" "_N" "Terrenos" "_H") (setq ss (ssadd)) (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h)) (ssadd (entlast) ss) (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "Terreno") (ssadd (entlast) ss) (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "4") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.-BVSTATE" "_N" "Comércios" "_H") (setq ss (ssadd)) (vl-cmdf "_.RECTANGLE" '(0.0 0.0) (list w h)) (ssadd (entlast) ss) (vl-cmdf "_.TEXT" "_J" "_ML" p ts "" "00") (ssadd (entlast) ss) (vl-cmdf "_.CHANGE" ss "" "_P" "_C" "5") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (vl-cmdf "_.BCLOSE") (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (princ) ) (or *k* (setq *k* 0)) (vla-endundomark *doc*) (vla-startundomark *doc*) (if (= 0 (getvar 'worlducs)) (progn (vl-cmdf "_.UCS" "_W") (setq ucsf t) ) ) (setq vars '("cmdecho" "osmode")) (setq vals (mapcar 'getvar vars)) (mapcar 'setvar vars '(0 0)) (if (and (setq p1 (getpoint "\nP1 <Início da Edificação>: ")) (setq p2 (getpoint p1 "\nP2 <Comprimento da Edificação>: ")) (setq p3 (getpoint p2 "\nP3 <Comprimento da Quadra>: ")) (or (not (equal (angle p1 p2) (angle p1 p3) 1e-4)) (alert "\nPoints are all in a straight line.") ) (not (initget 7)) (setq n (getint "\nQuantidade de Edificações ou Lotes: ")) (setq h (/ (distance p2 p3) n)) (setq w (distance p1 p2)) ) (progn (bmakerec3vs w h (/ h 4.0) (setq bnn (strcat "rec" (itoa (setq *k* (1+ *k*)))))) ;;;; Especifique diferentes textos em vez de (/ h 4.0) e seu nome exclusivo para bloco em vez de "rec" (você pode deixá-lo como novos nomes de blocos serão criados de acordo com o incremento da variável global * k *) (entdel (entlast)) (vl-cmdf "_.UCS" "_3P" p2 p1) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) (setq k -1) (repeat n (vl-cmdf "_.INSERT" bnn (list 0.0 (* h (setq k (1+ k))))) (while (< 0 (getvar 'cmdactive)) (vl-cmdf "")) ) (vl-cmdf "_.UCS" "_P") ) ) (*error* nil) ) (defun c:SD nil (c:Subdivide)) Subdivide.lsp tmp.lsp
  3. hello, as I motioned I am new here and need someone to help me and make for me autolisp routine or program that can automatically draft for me the building sides , so I just need to input for him the floor plans so he can draft the sides of the building automatically and also the sections of the building further without too much effort from me can someone be kind and do it for me ?
  4. I'm in the process of going through our company's old LISP routines. While most lisps were loaded as separate files through a single lisp load command, this code was just plopped into the lisp load command, with no comments. Can someone tell me what this code does and how to use it so I can decide if it's worth keeping? Thank you! (defun C:WC (/ INGET FPT GETD GETDTEMP ENAME ENAME1 ENT1 ENT2 SS1 SS2 SS3 SS4) (setq V1 (getvar "osmode")) (setq V2 (getvar "cmdecho")) (setvar "osmode" 0) (setvar "cmdecho" 0) (initget "Horizontal Vertical") (setq INGET (getkword "\nType of break [Horizontal/Vertical]: ")) (if (= GETDTEMP1 nil) (setq GETDTEMP1 (getreal "\nBreak Length: ")) (setq GETDTEMP1 (getreal (strcat "\nBreak Length <" (rtos GETDTEMP2) ">: "))) ) (if (or (= GETDTEMP1 "")(= GETDTEMP1 nil))(setq GETDTEMP1 GETDTEMP2)) (setq GETDTEMP2 GETDTEMP1) (setq GETD GETDTEMP1) (prompt "\nNow move Crosshairs near each intersection to break <press Enter to stop> :") (setq ENAME "LINE") (setq ENAME1 "LINE") (while GETD (setq FPT (osnap (cadr (grread 1)) "int")) (if (/= FPT NIL) (progn (setq SS1 (nentselp (polar FPT 0.00 GETD))) (setq SS2 (nentselp (polar FPT 3.14 GETD))) (setq SS3 (nentselp (polar FPT 1.57 GETD))) (setq SS4 (nentselp (polar FPT 4.71 GETD))) (setq ENT1 (ssget (polar FPT 0.00 GETD))) (setq ENT2 (ssget (polar FPT 1.57 GETD))) ) ) (if (and (/= ENT1 NIL)(/= ENT2 NIL)) (progn (setq ENAME (cdr (assoc 0 (entget (ssname ENT1 0))))) (setq ENAME1 (cdr (assoc 0 (entget (ssname ENT2 0))))) ) ) (if (and (/= ENAME "LINE")(/= ENAME "LWPOLYLINE")(or (= INGET "Horizontal")(= INGET NIL))) (progn (print "Entity is not a Line or Polyline") (setq FPT NIL) ) ) (if (and (/= ENAME1 "LINE")(/= ENAME1 "LWPOLYLINE")(= INGET "Vertical")) (progn (print "Entity is not a Line or Polyline") (setq FPT NIL) ) ) (if (and (/= FPT NIL)(/= SS1 NIL)(/= SS2 NIL)(/= SS3 NIL)(/= SS4 NIL)(or (= INGET "Horizontal")(= INGET NIL))) (command ".BREAK" (cadr SS1)(cadr SS2)) ) (if (and (/= FPT NIL)(= INGET "Vertical")(/= SS1 NIL)(/= SS2 NIL)(/= SS3 NIL)(/= SS4 NIL)) (command ".BREAK" (cadr SS3)(cadr SS4)) ) ) (setvar "osmode" V1) (setvar "cmdecho" V2) (princ) ) ;wc
  5. Hi Guys, Here is what I could do till now with the below code (mainly from Tharwat, but I tweaked a just bit): 1) It asks for the user input to specify the origin (basically setting the UCS) 2) Export XY & Diameter detail to the excel file (converted XY to current UCS using trans function) 3) Adds a 0,0-Origin text so that user knows whether the origin is correct or not. what I'm looking for is this : 1) All the entities (arc or circles) should be numbered on the drawing 1,2,3 etc.... 2) The table what it creates should have the First column for serial numbers (per item 1) and Fifth column for the type of entity (e.g. Arc or Circle) to identify the object type. Can someone help me on this please? Cheers
  6. Hello All, I have a lisp for making a series of modifications one dynamic block at time. I have the lisp working but it errors out when a non-dynamic block is selected. My goal is to create a while loop that keeps looping until the user selects a dynamic block (or preferably matching a certain name.) I am not sure how to write the check... Here is an excerpt from the code. (vl-load-com) (setq acadDocument (vla-get-activedocument(vlax-get-acad-object))) (setq RX (entsel)) (setq oBkRef (vlax-Ename->Vla-Object (car RX)))
  • Create New...