Jump to content

Search the Community

Showing results for tags 'entmake'.

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

  1. (defun c:bcr (/ Make_MText i ss ent) (defun *error* ( msg ) (foreach lay lck (vla-put-lock lay :vlax-true)) (if (= 'int (type cmd)) (setvar 'cmdecho cmd)) (LM:endundo (LM:acdoc)) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\nError: " msg)) ) (princ) ) (defun Make_MText (pt str) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt) (cons 1 str)))) (if (setq i -1 ss (LM:ssget "\nSelect block <exit>: " '(((0 . "INSERT"))))) (while (setq ent (ssname ss (setq i (1+ i)))) (Make_MText (cdr (assoc 10 (entget ent))) (apply (function strcat) (mapcar (function strcat) '("E " "\nN") (mapcar (function rtos) (cdr (assoc 10 (entget ent))))))))) (princ)) (defun LM:ssget ( msg arg / sel ) (princ msg) (setvar 'nomutt 1) (setq sel (vl-catch-all-apply 'ssget arg)) (setvar 'nomutt 0) (if (not (vl-catch-all-error-p sel)) sel) ) every time when i make leader i have to put "p2" i need fixed type leader. as shown this is text. but i need text with leader or ml leader how can i make ?????
  2. Can someone help me to find the solution for some doubts. If someone will make one lisp for this, so I think I will get answer for few doubts I need to draw a pline inside this 4 line using line point like this My doubts 1 how to get “line point” with window selection (4 line all pints not in window only 4 line 4 point) (setq p1 (getpoint "\nSelect object...")) (setq p2 (getcorner p1)) (setq mp (polar p1 (angle p1 p2) (/ (distance p1 p2) 2))) (setq p1 (list (nth 0 p1) (nth 1 p1))) (setq p2 (list (nth 0 p2) (nth 1 p2))) (if (not (equal '(nil nil) (sssetfirst nil (ssget "_C" p1 p2 '((0 . "LINE")))))) (setq lines (ssget "_:L"))) (if (/= (sslength lines) 4) (alert "4 lines need to be selected") 2 how to segregate the entity (which one is first which one is last) 3 how to entmake pline
  3. In continuation of this thread I would like to continue this interesting story about UCSs and transformed entities. So far I have understood ( I am thankful to the community here) that An OCS is an coordinate system that most of the Autocad entities use instead of any other CS An OCS share the same origin with the WCS, however its x,y,z may be other than the one of the WCS However, it seems that something still eludes me and I cannot fully grasp it. I made a very simple model with a line drawn in WCS from 0,0,0 to 1,2,3. I would like to insert the same model on this one, that is having this line sitting on the end point (1,2,3) of the other as an extension. That means the lines need to be collinear. Let's assume I mirror3d this line on the xy plane, so the extrusion vector now becomes 0.0 0.0 -1.0. Using the following snippet the line comes on the correct placement but the orientation is wrong. What am I missing? ; clicking the mirrored entity from 0,0,0 to 1,2,-3 (setq pt (cdr (assoc 11 (setq ent (entget (car (entsel))))))) (setq v (cdr (assoc 210 ent))) ; inserting the drawing (entmakex (list (cons 0 "INSERT") (cons 2 "Dwg") (cons 8 "0") (cons 10 (trans (trans pt 0 1) 1 v)) (cons 70 0) (cons 66 1) (cons 50 0) (cons 210 v) ) ) Any suggestions appreciated.
  4. Hi. I am generating a block using ENTMAKE, but I have noticed that the property "InsUnits (RO)" indicates "Unitless". The variable "INSUNITS of the document (drawing) is set to "6" for Meters, but when generating the Block the property is set as Unitless. How do I assign the property to the BLOCK as this is the INSUNITS variable? (defun ent-block (nameBlock pto-ins atrib-var / ) (entmake (list '(0 . "BLOCK") '(100 . "AcDbEntity") '(100 . "AcDbBlockBegin") '(8 . "0") (cons 2 nameBlock) (cons 10 pto-ins) (cons 70 (if atrib-var 2 0)) ) ) ) (defun makeBlockGMM (listaEntNames nameBlock pto-ins atrib-var / msg ciclo) (defun ciclo ( listaEntNames / X) (foreach X listaEntNames (entmake (entget X)) ) ) (if (vl-catch-all-error-p (setq resultado01 (vl-catch-all-apply 'ent-block (list nameBlock pto-ins atrib-var)))) (progn (prompt (setq msg (strcat "**ERROR en Cabecera, mensage de error: " (vl-catch-all-error-message resultado01)))) ) ) (if (and (not msg ) (vl-catch-all-error-p (setq resultado02 (vl-catch-all-apply 'ciclo (list listaEntNames))))) (progn (prompt (setq msg (strcat "**ERROR en creacion de entidades, mensage de error: " (vl-catch-all-error-message resultado02)))) ) ) (if (and (equal resultado1 nil) (equal resultado2 nil)) (progn (ent-endblock) ) ) ) (defun ent-endblock ( / ) (entmake (list '(0 . "ENDBLK") '(100 . "AcDbEntity") '(100 . "AcDbBlockEnd") '(8 . "0") ) ) ) Regards.
  5. Hi, I was wondering if i could use two commands, line and dimlinear, in a single lisp file. this one i have measures a line you set with two points and creates a line that is a 1/3 in length of the distance between the two points. I want to add dimension line that will be 500 units above the created line. Any help would be very much appreciated. Thank you in advance. (defun c:aa () (setq po1 (getpoint "Pick first point:") po2 (getpoint po1 "Pick second point:") le (/ (distance po1 po2) 3) po3 (polar po1 (angle po1 po2) le)) (entmake (list '(0 . "LINE") (cons 10 po1) (cons 11 po3))) )
  6. 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
  7. I am working off of this code cadpanacea.com/node/186, but when I try to run the following, the radius of the circular hatch varies based on the 'ctr' variable's distance from the origin. I would like it to depend solely on the 'ctr' and 'edge' points. (defun c:test()(setvar "osmode" 0) (setq ctr (getpoint "\nCenter of Circle: ")) (setq edge (getpoint "\nEdge of Circle: ")) (entmakex (list (cons 0 "HATCH") (cons 100 "AcDbEntity") (cons 8 "E-GRND") (cons 100 "AcDbHatch") (cons 10 ctr) (cons 210 (list 0 0 1)) (cons 2 "SOLID") (cons 70 1) (cons 71 0) (cons 91 1) (cons 92 1) (cons 93 1) (cons 72 3) ;the "3" designates this is an elliptical shape, 1 for circle (cons 10 ctr) ;center point of ellipse (cons 11 edge) ;point of top quad (cons 40 1) ;ratio of width to height (cons 50 0.0) ;start angle (cons 51 (* pi 2.0)) ;end angle (full ellipse) (cons 73 1) ;counterclockwise flag (cons 97 0) (cons 75 0) (cons 76 1) (cons 98 1) (cons 10 (list 0 0 0)) ))
  8. Hello! I just stared working in AutoLISP a few days ago, and I've come across a problem. I need to create a dimension line where the dimension value is dependent on an input value. So if the input is y, then the text on the dimension line should equal 4.5*(y+1) inches, and it also needs to have a character width of 0.75. Currently, it just displays 4 1/2". As I understand it, this would be a real number, meaning I can't concatenate it with the inches symbol. Any help would be greatly appreciated! (defun c:retan (/ p1 p2 p3 p4 x y i j)(setvar "osmode" 0) (setq p1 (getpoint "\nfirst corner of rectangle: ")) (setq x (getint "\nEnter Horizontal Count: ")) (setq y (getint "\nEnter Vertical Count: ")) (setq p3 (list (+ (+ 1.625 (* 0.8125 (- x 1))) (car p1))(+ (+ 1.625 (* 0.8125 (- y 1))) (cadr p1)))) (setq p2 (list (car p1)(cadr p3))) (setq p4 (list (car p3)(cadr p1))) (command "pline" p1 p2 p3 p4 "c") ;c closes the rectangle's fourth side (entmakex (list (cons 0 "DIMENSION") (cons 100 "AcDbEntity") (cons 8 "E-DIMS") ;; 8 Layer (cons 100 "AcDbDimension") (cons 10 (list (- (car P1) 0.7) (cadr P2) 0)) ;; 10 Arrow Node (cons 11 (list (- (car P1) 0.9) (/ (+ (cadr P2)(cadr P1)) 2) 0)) ;; 11 Text Position (cons 70 160) (cons 1 "{\\W0.75;4 1/2\"}") ;; 1 Contents of Dimension Textbox (cons 71 5) ;; 71 Text Alignment (5=centered) (cons 42 0.8125) (cons 53 1.5708) ;; 53 Text Rotation (cons 3 "REW-1_.125txt") (cons 100 "AcDbAlignedDimension") (cons 13 P1) ;; 13 point on line (cons 14 P2) ;; 14 point on line (cons 50 1.5708) ;; 50 Angle (radians) 1.5708 (cons 100 "AcDbRotatedDimension"))) (setvar "osmode" 16383)(princ) )
  9. Why "too few arguments"? (defun c:mci (cp) (setq cp (getpoint "\nCenter point:")) (entmake (list (cons 0 "CIRCLE");;Entity (cons 62 5);;Color (cons 10 cp);;Center point (cons 40 2);;Radius ) ) (princ) )
  10. I am trying to write a routine that allows users to input items and weights in a dialog box, and outputs a formatted MText (among other things). I allow the user to input up to 10 items, but I only want the MText to use the values that are filled in. Here's what my dialog box looks like: And here's what my output looks like: Here's my code for the Mtext: (setq val (strcat "\\pxtr18,c20,r30;\t" eq1 "\t=\t" wt1 " LB \\P\t" eq2 "\t=\t" wt2 " LB \\P\t" eq3 "\t=\t" wt3 " LB \\P\t" eq4 "\t=\t" wt4 " LB \\P\t" eq5 "\t=\t" wt5 " LB \\P\t" eq6 "\t=\t" wt6 " LB \\P\t" eq7 "\t=\t" wt7 " LB \\P\t" eq8 "\t=\t" wt8 " LB \\P\t" eq9 "\t=\t" wt9 " LB \\P\t" eq10 "\t=\t" wt10 " LB" )) (entmake (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 pt1) (cons 1 val) (cons 8 "NOTES") (cons 40 0.09375) (cons 7 "ROMANS") (cons 41 4))) Any suggestions how to make it ignore the "0" values? Thanks in advance!
  11. dirkvandonkelaar

    Annotative text style

    Hi guys, I'm learning to use LISP functions and came across an problem. Maybe it has been asked thousand times, but I couldn't find an relative thread here. I want to create a function that checks if there is an text style named "Tekst 2.5". Now, the problem is that i can't get the text style to be annotative This is what I have: (defun c:test (/) (if (null (tblsearch "style" "tekst 2.5")) (entmake (list '(0 . "STYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbTextStyleTableRecord") '(2 . "Tekst 2.5") ; Style name '(70 . 0) ; Standard flag values (bit-coded values) '(40 . 2.5) ; text height '(41 . 1.0) ; width factor '(50 . 0.0) ; oblique angle '(71 . 1) ; text generation "0" normal text '(42 . 0) ; last height used '(3 . "Arial.ttf") ; font file name '(4 . "") ; bigfont (blank for no) ) ; end list ) ; end entmake ) ; end if (princ) ) Does any of you know hou to get it annotative using entmake?
×
×
  • Create New...