samifox Posted December 24, 2013 Posted December 24, 2013 hi i need to create an entity by entmake, how can i know what DXF codes are mandatory? and what is the different of entmake and entmakex? thanks Quote
Snownut Posted December 24, 2013 Posted December 24, 2013 I can't believe you could not find this out by doing a search on this site ! Quote
Tharwat Posted December 24, 2013 Posted December 24, 2013 Here is a LINK for the DXF codes that related to LWpolyline . The entmake and entmakex are the same , except for the return value , the entmake returns the DXF codes but the entmakex returns the entity name of the created object . Quote
David Bethel Posted December 24, 2013 Posted December 24, 2013 I have found very limited info on mandatory groups This is what I have on entmake : ;;;ANNONYMOUS BLOCK (entmake (list (cons 0"BLOCK")(cons 2 "*U")(cons 70 1)(cons 10 '(0 0 0)))) (setq ab (entmake '((0 . "ENDBLK")))) (entmake (list (cons 0 "INSERT")(cons 2 ab)(cons 10 '(0 0 0)))) ;*** = Required Group (entmake (list (cons 0 "3DFACE") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 11 (list 1.0 0.0 0.0)) ;*** (cons 12 (list 0.0 1.0 0.0)) ;*** (cons 13 (list 1.0 1.0 0.0)) ;*** (cons 39 0.0) (cons 62 256) (cons 70 0))) (entmake (list (cons 0 "ARC") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 1.0) ;*** (cons 50 0.0) ;*** (cons 51 1.57079633) ;*** (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "ATTDEF") ;*** (cons 8 "0") (cons 10 (list 0 0 0)) ;*** (cons 40 1) ;*** (cons 1 "") ;*** (cons 3 "") ;*** (cons 2 "TEST") ;*** (cons 70 0) ;*** (cons 73 0) (cons 50 0) (cons 41 1) (cons 51 0) (cons 7 "STANDARD") ;*** (cons 71 0) (cons 72 0) (cons 11 (list 0 0 0)) ;*** (cons 210 (list 0 0 1)) (cons 74 0) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "CIRCLE") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 1.0) ;*** (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "INSERT") ;*** (cons 2 "LEG6") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 41 1.0) (cons 42 1.0) (cons 43 1.0) (cons 44 0.0) (cons 45 0.0) (cons 50 0.0) (cons 62 256) (cons 70 0) (cons 71 0) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "INSERT") ;*** (cons 8 "0") (cons 66 1) ;*** (cons 2 "CP") ;*** (cons 10 (list 0 0 0)) ;*** (cons 41 1) (cons 42 1) (cons 50 0) (cons 43 1) (cons 70 0) (cons 71 0) (cons 44 0) (cons 45 0) (cons 210 (list 0 0 1)) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "ATTRIB") ;*** (cons 8 "0") (cons 10 (list 0 0 0)) ;*** (cons 40 1) ;*** (cons 1 "TESTING 123") ;*** (cons 2 "TAGNAME") ;*** (cons 70 0) ;*** (cons 73 0) (cons 50 0) (cons 41 1) (cons 51 0) (cons 7 "STANDARD") ;*** (cons 71 0) (cons 72 0) (cons 11 (list 0 0 0)) (cons 210 (list 0 0 1)) (cons 74 0) (cons 62 256) (cons 39 0) (cons 6 "BYLAYER"))) (entmake (list (cons 0 "SEQEND") ;*** (cons 8 "0"))) ;*** (entmake (list (cons 0 "LINE") (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 11 (list 0.0 1.0 0.0)) ;*** (cons 39 0.0) (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "LWPOLYLINE") ;*** (cons 100 "AcDbEntity") ;*** (cons 67 0) (cons 410 "Model") (cons 8 "0") (cons 100 "AcDbPolyline") ;*** (cons 90 2) ;*** (cons 70 0) (cons 43 0) (cons 38 0) (cons 39 0) (cons 10 (list 6 7)) ;*** (cons 40 0) (cons 41 0) (cons 42 0) (cons 10 (list 10 10)) ;*** (cons 40 0) (cons 41 0) (cons 42 0) (cons 210 (list 0 0 1)))) (entmake (list (cons 0 "POLYLINE") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 0.0) (cons 41 0.0) (cons 62 256) (cons 66 1) ;*** (cons 70 0) ;*** (cons 71 0) (cons 72 0) (cons 73 0) (cons 74 0) (cons 75 0) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "VERTEX") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 0.0) (cons 41 0.0) (cons 42 0.0) (cons 50 0.0) (cons 70 0) ;*** (cons 71 0) (cons 72 0) (cons 73 0) (cons 74 0) (cons 62 256))) (entmake (list (cons 0 "VERTEX") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 1.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 0.0) (cons 41 0.0) (cons 42 0.0) (cons 50 0.0) (cons 70 0) ;*** (cons 71 0) (cons 72 0) (cons 73 0) (cons 74 0) (cons 62 256))) (entmake (list (cons 0 "SEQEND") ;*** (cons 8 "0"))) (entmake (list (cons 0 "POINT") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 50 0.0) (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "SOLID") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 11 (list 1.0 0.0 0.0)) ;*** (cons 12 (list 0.0 1.0 0.0)) ;*** (cons 13 (list 1.0 1.0 0.0)) ;*** (cons 39 0.0) (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "TEXT") ;*** (cons 1 "") ;*** (cons 6 "BYLAYER") (cons 7 "STANDARD") ;*** (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 11 (list 0.0 0.0 0.0)) ;*** (cons 39 0.0) (cons 40 1.0) ;*** (cons 41 1.0) (cons 50 0.0) (cons 51 0.0) (cons 62 256) (cons 71 0) (cons 72 0) (cons 73 0) (cons 210 (list 0.0 0.0 1.0)))) (entmake (list (cons 0 "TRACE") ;*** (cons 6 "BYLAYER") (cons 8 "0") (cons 10 (list 0.0 0.0 0.0)) ;*** (cons 11 (list 0.0 1.0 0.0)) ;*** (cons 12 (list 1.0 0.0 0.0)) ;*** (cons 13 (list 1.0 1.0 0.0)) ;*** (cons 39 0.0) (cons 62 256) (cons 210 (list 0.0 0.0 1.0)))) The problem with the documentation is that the default values that they list are for DXFIN, nor ( entmake ). And the are vast discrepancies between the 2. An example would be group 62 COLOR : DXFIN default is 256 ( BYLAYER ) ( entmake ) is sysvar "CECOLOR" Other groups that this can affect are 6 38 39 & 48 There also differing defaults of a ( command ) vs ( entmake ) call as well. ( command ) default for 210 is the current UCS ( entmake ) default is WCS '(0 0 1) HTH -David Quote
samifox Posted December 24, 2013 Author Posted December 24, 2013 Lots of useful info here but I didn't get answer to one of my questions . What dxf code must be in the argument list in order to get Away with new poly? Quote
Lee Mac Posted December 24, 2013 Posted December 24, 2013 Lots of useful info here but I didn't get answer to one of my questions . What dxf code must be in the argument list in order to get Away with new poly? David has answered that question with his post - look at the groups for the LWPOLYLINE entity. Quote
samifox Posted December 24, 2013 Author Posted December 24, 2013 Oops sorry David I've missed it Quote
ymg3 Posted December 24, 2013 Posted December 24, 2013 samifox, Here is a bit of code by AlanJT which I keep reusig for this purpose. ;;******************************************************************************; ;; mk_lwp by Alan J Thompson ; ;; Argument: pl, A list of points (2d or 3d) ; ;; Create an LWPolyline at Elevation 0 ; ;;******************************************************************************; (defun mk_lwp (pl) (vlax-ename->vla-object (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length pl)) '(70 . 0) ) (mapcar '(lambda (p) (cons 10 (trans (list (car p) (cadr p)) 1 0))) pl) ) ) ) ) As is, it returs an Object name. The difference between entmake and entmakex is what it returns. entmake returns the entity list. entmakex returns the entity name. Merry Christmas! ymg Quote
samifox Posted December 29, 2013 Author Posted December 29, 2013 hi why would this code give a bad argument error (entmake (list (cons 0 "LWPOLYLINE") ;*** (cons 100 "AcDbEntity") ;*** (cons 8 "0") (cons 100 "AcDbPolyline") ;*** (cons 90 2) ;*** (cons 10 (list StartPt EndPt)) ;*** ) ) StartPt and EndPt are points i got from (getpoint) Thanks Shay Quote
Tharwat Posted December 29, 2013 Posted December 29, 2013 Can you post the value of the two variables StartPt and EndPt ? Since that you have defined the dxf 90 with two vertices you should support it two as well Quote
Snownut Posted December 29, 2013 Posted December 29, 2013 You are trying to use 2-pnts for the "10" dxf code, that is not the proper method, look back on Davids post #4. Quote
Snownut Posted December 29, 2013 Posted December 29, 2013 Here's one from LeeMac, that has all you could ever want in an Entmake Polyline function. (defun DrPline ( ) (ENTMAKE (APPLY (FUNCTION APPEND) (CONS (LIST '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") (CONS 8 Lname) ; Layer (cons 6 linetp) ; Linetype (cons 62 color ) ; Color '(100 . "AcDbPolyline") (CONS 90 (LENGTH point-list)) ; Vertices (CONS 70 clop) ; 1=Closed Polyline 0= Open Polyline ) (MAPCAR (FUNCTION LIST) (MAPCAR (FUNCTION (LAMBDA (a) (CONS 10 a))) point-list) (MAPCAR (FUNCTION (LAMBDA (b) (CONS 42 b))) bulge-list) (MAPCAR (FUNCTION (LAMBDA (c) (CONS 43 c))) width-list) ) ) ) ) );defun You will need the list defined; Point-list Width-list Bulge-list (for arcs, there is information out there for defining the bulge angle) The other variables also need to be defined; Lname (layer name, if non-existant it will be created) LineTp (linetype) Color Clop (whether pline is opened or closed 0=open 1-closed) Please make sure the list correspond with each other (items match each other). With this Polyline function you should not need any others you should be able to adjust this for any situation. Note; The Bulge-List & Width-list can both be 0, however they need to contain the same number elements as the Point-List ex. Point-list = ((23.34 34.54 0)(34.43 56.34 0)) Width-List= ( 0 0) Quote
marko_ribar Posted December 29, 2013 Posted December 29, 2013 Snownut, if LWPOLYLINE has bulge factors, DXF70 for open pline is 128 and for closed 129... Quote
ymg3 Posted December 29, 2013 Posted December 29, 2013 why would this code give a bad argument error (entmake (list (cons 0 "LWPOLYLINE") ;*** (cons 100 "AcDbEntity") ;*** (cons 8 "0") (cons 100 "AcDbPolyline") ;*** (cons 90 2) ;*** (cons 10 StartPt) (cons 10 EndPt) ;*** ) ) or simply using routine from my previous post: (mk_lwp (list StartPt EndPt)) Quote
Snownut Posted December 29, 2013 Posted December 29, 2013 Marko, that's odd when I use the visual lisp editor and inspect a LWPOLYLINE it shows DXF code 70 as a 0 or 1. Works fine in ACAD & BricsCAD with the 0 or 1. (I just double checked...) Bruce Quote
Lee Mac Posted December 29, 2013 Posted December 29, 2013 Snownut, if LWPOLYLINE has bulge factors, DXF70 for open pline is 128 and for closed 129... The 128 bit-code for DXF Group 70 is for linetype generation, it has nothing to do with bulge. Documentation: http://exchange.autodesk.com/autocad/enu/online-help/browse#WS1a9193826455f5ff18cb41610ec0a2e719-79fc.htm Quote
Snownut Posted December 29, 2013 Posted December 29, 2013 Lee, you must be bored today, you've been lurking everywhere.... (not that I mind, you are of great assistance) Bruce Quote
marko_ribar Posted December 29, 2013 Posted December 29, 2013 The 128 bit-code for DXF Group 70 is for linetype generation, it has nothing to do with bulge. Documentation: http://exchange.autodesk.com/autocad/enu/online-help/browse#WS1a9193826455f5ff18cb41610ec0a2e719-79fc.htm Yes, Lee you're right again... I've turned linetype generization some time ago, and I was totally confused why DXF70 showed me 128 and 129 for LWPOLYLINE, when I knew that actually DXF70 0 and 1 were for open/closed plines... I've turned on generization for I wanted to display direction of polylines through one of linetypes I've made with arrows... So this explains, thanks Lee... Quote
samifox Posted December 29, 2013 Author Posted December 29, 2013 (defun getInput (/ steelType StartPt EndPt pinLength segCount diameter olapLength tp breakList StartPtPin EndPtPin) (setvar "OSMODE" 1) (if (setq StartPt (getpoint "\nStart point of element")) (if (setq EndPt ( getpoint StartPt "\nEnd point of element: ")) (list (cons 10 StartPt) (cons 11 EndPt) (cons 12 (distance StartPt EndPt)) (cons 44 (angle StartPt EndPt)) ) ) ) ) Quote
samifox Posted December 30, 2013 Author Posted December 30, 2013 hi how can i retrive the last end end vertex of the last drawn entity? lets say (entmake (list (cons 0 "LWPOLYLINE") ;*** (cons 100 "AcDbEntity") ;*** (cons 8 "0") (cons 100 "AcDbPolyline") ;*** (cons 90 2) ;*** (cons 10 '(40.0 432.0 0.0)) ;*** (cons 10 '(3.0 400.0 0.0)) ) ) (entmake (list (cons 0 "LWPOLYLINE") ;*** (cons 100 "AcDbEntity") ;*** (cons 8 "0") (cons 100 "AcDbPolyline") ;*** (cons 90 2) ;*** (cons 10 '(4.0 400.0 0.0)) ;*** (cons 10 '(400.0 4.0 0.0)) ) ) i want to get the start and the end vertex of the last drawn poly thanks Shay Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.