Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. Working in an 11" x 17" border, my text, item bubbles & material list appear at the proper ratio to the border. But, when I work in a 24" x 36" border, these items all come in really small, as if they were still populating an 11: x 17" border. The admin that created the larger border for us is no longer working here. What is the proper procedure to fix this problem? Inventor Professional 2018
  3. dlanorh

    Add text to polyline vertexes

    If you select a single vertex does this vertex get the letter "A" or the letter of the vertex parameter (i.e. if it is the 3rd vertex in the polyline it would get the letter "C")? This is the revised code to place the text outside the polyline for all vertices. I will try to incorporate a single vertex when I have the answer to the above question. (defun c:LPV ( / ent ll ur m_pt last_v e_pt s_pt t_ht cnt v_pt) (cond ( (and (setq ent (car (entsel "\nSelect Polyline to Label : "))) (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") );end_and (vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur) (setq m_pt (mapcar '(lambda (x y) (/ (+ x y) 2.0)) (vlax-safearray->list ll) (vlax-safearray->list ur)) last_v (vlax-curve-getendparam ent) e_pt (vlax-curve-getendpoint ent) s_pt (vlax-curve-getstartpoint ent) t_ht (getvar 'textsize) t_fact 1.1 cnt 0.0 );end_setq (if (equal e_pt s_pt 0.001) (setq last_v (1- last_v))) (while (<= cnt last_v) (setq v_pt (vlax-curve-getpointatparam ent cnt)) (entmakex (list (cons 0 "TEXT") (cons 7 (getvar 'textstyle)) (cons 40 t_ht) (cons 10 (polar m_pt (angle m_pt v_pt) (+ (* t_ht t_fact) (distance m_pt v_pt)))) (cons 11 (polar m_pt (angle m_pt v_pt) (+ (* t_ht t_fact) (distance m_pt v_pt)))) (cons 1 (chr (+ 65 (fix cnt)))) (cons 72 1) (cons 73 2) );end_list );end_entmakex (setq cnt (1+ cnt)) );end_while ) ( (alert "Not a Polyline")) );end_cond (princ) );end_defun (princ)
  4. Hello Iam looking for a lisp that select a closed polyline "hidden" layer "shield" color "10", --> select all text on layer "RoomNR" inside this polyline and store the text data in a excel file. And store the Excel file in the dwg root (dwgprefix). Regards, jm test2.dwg
  5. @Lee Mac, thank for respond. At least I know it's possible. @NoamBrand, yeah, I know it. I was wondering how do it all by lisp. First my idea was to do few lisp with the same attribute but other value go to .txt and after that to excel. But I failed. And now here. Anyway, thanks for tips, I gratful for your respond.
  6. Lee, it works perfect. Ronjonp also thanks for the second one. Could be very useful. jm
  7. There is a warning symbol next to the plot style making me think that the drawing is set for stb but it is looking for a ctb. Confirm if that is the case or not.
  8. Ideally you would rename one or the other LISP. If the LISP with the duplicated name is called / run from another LISP as a subroutine you could simply reload the file containing the duplicate named LISP as required and make it the most recent one to be loaded. Use a line similar to this. (load "-filepath and LISP file name remember to use \\ insted of single \ as required - " "LISP Failed to Load") So long as the file name and location won't change this should work - not ideal mind,
  9. Lee Mac

    Add text to polyline vertexes

    Whilst this is possible when labelling all vertices of a polyline (since the program can calculate the offset direction using the direction of the surrounding polyline segments), when supplied only with a point, the appropriate offset direction cannot be determined.
  10. amir0914

    Add text to polyline vertexes

    Thanks you Tharwat and leemac, my problem is resolved, but Can you change code or add new code to add text outside of polyline, like below image :
  11. Here's another that matches some properties of the replaced block: (defun c:foo (/ _dxf e o o2 p s) ;; RJP » 2019-01-16 (defun _dxf (c e) (cdr (assoc c (entget e)))) (cond ((and (setq e (car (entsel "\nPick source block: "))) (= "INSERT" (_dxf 0 e)) (setq s (ssget ":L" '((0 . "insert")))) ) (ssdel e s) (setq p (_dxf 10 e)) (setq e (vlax-ename->vla-object e)) (foreach b (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq o (vla-copy e)) (vlax-invoke o 'move p (_dxf 10 b)) ;; Pick what properties you want to match (setq o2 (vlax-ename->vla-object b)) (vla-put-rotation o (vla-get-rotation o2)) (vla-put-xscalefactor o (vla-get-xscalefactor o2)) (vla-put-yscalefactor o (vla-get-yscalefactor o2)) (vla-put-zscalefactor o (vla-get-zscalefactor o2)) (vla-put-layer o (vla-get-layer o2)) (vla-put-color o (vla-get-color o2)) (vla-put-linetype o (vla-get-linetype o2)) (vla-put-lineweight o (vla-get-lineweight o2)) (entdel b) ) ) ) (princ) )
  12. Try the following code: (defun c:matchblock ( / att blk ent idx lst obj par sel vis ) (while (progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect source block <exit>: "))) (cond ( (= 7 (getvar 'errno)) (princ "\nMissed, try again.") ) ( (null ent) nil) ( (/= "AcDbBlockReference" (vla-get-objectname (setq obj (vlax-ename->vla-object ent)))) (princ "\nThe selected object is not a block.") ) ( (= :vlax-false (vla-get-hasattributes obj) (vla-get-isdynamicblock obj)) (princ "\nThe selected block is neither attributed nor dynamic.") ) ) ) ) (if (and ent (setq sel (LM:ssget "\nSelect target blocks <exit>: " '("_:L" ((0 . "INSERT")))))) (progn (setq obj (vlax-ename->vla-object ent) att (LM:vl-getattributevalues obj) vis (LM:getvisibilitystate obj) ) (repeat (setq idx (sslength sel)) (setq idx (1- idx) obj (vlax-ename->vla-object (ssname sel idx)) ) (if att (LM:vl-setattributevalues obj att)) (if (and vis (= :vlax-true (vla-get-isdynamicblock obj)) (or (setq blk (strcase (LM:effectivename obj)) par (cdr (assoc blk lst)) ) (and (setq par (LM:getvisibilityparametername obj)) (setq lst (cons (cons blk par) lst)) ) ) ) (vl-some '(lambda ( prp ) (if (and (= par (vla-get-propertyname prp)) (member vis (vlax-get prp 'allowedvalues)) ) (vla-put-value prp (vlax-make-variant vis (vlax-variant-type (vla-get-value prp)))) ) ) (vlax-invoke obj 'getdynamicblockproperties) ) ) ) ) ) (princ) ) ;; Effective Block Name - Lee Mac ;; obj - [vla] VLA Block Reference object (defun LM:effectivename ( obj ) (vlax-get-property obj (if (vlax-property-available-p obj 'effectivename) 'effectivename 'name ) ) ) ;; Get Attribute Values - Lee Mac ;; Returns an association list of attributes present in the supplied block. ;; blk - [vla] VLA Block Reference Object ;; Returns: [lst] Association list of ((<tag> . <value>) ... ) (defun LM:vl-getattributevalues ( blk ) (mapcar '(lambda ( att ) (cons (vla-get-tagstring att) (vla-get-textstring att))) (vlax-invoke blk 'getattributes)) ) ;; Set Attribute Values - Lee Mac ;; Sets attributes with tags found in the association list to their associated values. ;; blk - [vla] VLA Block Reference Object ;; lst - [lst] Association list of ((<tag> . <value>) ... ) ;; Returns: nil (defun LM:vl-setattributevalues ( blk lst / itm ) (foreach att (vlax-invoke blk 'getattributes) (if (setq itm (assoc (vla-get-tagstring att) lst)) (vla-put-textstring att (cdr itm)) ) ) ) ;; Get Dynamic Block Visibility State - Lee Mac ;; Returns the value of the Visibility Parameter of a Dynamic Block (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; Returns: [str] Value of Visibility Parameter, else nil (defun LM:getvisibilitystate ( blk / vis ) (if (setq vis (LM:getvisibilityparametername blk)) (LM:getdynpropvalue blk vis) ) ) ;; Get Dynamic Block Property Value - Lee Mac ;; Returns the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) (defun LM:getdynpropvalue ( blk prp ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value))) (vlax-invoke blk 'getdynamicblockproperties) ) ) ;; Get Visibility Parameter Name - Lee Mac ;; Returns the name of the Visibility Parameter of a Dynamic Block (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; Returns: [str] Name of Visibility Parameter, else nil (defun LM:getvisibilityparametername ( blk / vis ) (if (and (vlax-property-available-p blk 'effectivename) (setq blk (vla-item (vla-get-blocks (vla-get-document blk)) (vla-get-effectivename blk) ) ) (= :vlax-true (vla-get-isdynamicblock blk)) (= :vlax-true (vla-get-hasextensiondictionary blk)) (setq vis (vl-some '(lambda ( pair ) (if (and (= 360 (car pair)) (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair))))) ) (cdr pair) ) ) (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary blk)) "ACAD_ENHANCEDBLOCK" ) ) ) ) (cdr (assoc 301 (entget vis))) ) ) ;; ssget - Lee Mac ;; A wrapper for the ssget function to permit the use of a custom selection prompt ;; msg - [str] selection prompt ;; arg - [lst] list of ssget arguments (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) ) (vl-load-com) (princ)
  13. Lee Mac

    Add text to polyline vertexes

    Below is a solution defining two commands (LPNT & LVTX) to label an arbitrary number of selected points, or a set of polylines with an arbitrary number of vertices: (defun c:lpnt ( / ocs pnt str ) (setq ocs (trans '(0 0 1) 1 0 t) str "" ) (while (setq pnt (getpoint (strcat "\nSpecify point \"" (setq str (LM:alpha++ str)) "\" <exit>: "))) (entmaketext (trans pnt 1 ocs) str ocs) ) (princ) ) (defun c:lvtx ( / enx idx ocs sel str ) (if (setq sel (ssget '((0 . "LWPOLYLINE")))) (repeat (setq idx (sslength sel)) (setq idx (1- idx) enx (entget (ssname sel idx)) ocs (cdr (assoc 210 enx)) str "" ) (foreach dxf enx (if (= 10 (car dxf)) (entmaketext (cdr dxf) (setq str (LM:alpha++ str)) ocs) ) ) ) ) (princ) ) (defun entmaketext ( ins str ocs ) (entmake (list '(000 . "TEXT") (cons 010 ins) (cons 011 ins) (cons 001 str) (cons 040 (getvar 'textsize)) (cons 007 (getvar 'textstyle)) (cons 050 (angle '(0.0 0.0) (trans (getvar 'ucsxdir) 0 ocs t))) '(072 . 1) '(073 . 2) (cons 210 ocs) ) ) ) ;; Alpha++ - Lee Mac ;; Increments an uppercase alphabetical string by one, e.g. AZ => BA ;; a - [str] uppercase alphabetical string (defun LM:alpha++ ( a / n ) (if (= "" a) "A" (if (= "Z" (substr a (setq n (strlen a)))) (strcat (LM:alpha++ (substr a 1 (1- n))) "A") (strcat (substr a 1 (1- n)) (chr (1+ (ascii (substr a n))))) ) ) ) (princ "\n\"LPNT\" to label points | \"LVTX\" to label vertices") (princ) The commands should also operate successfully under all UCS & View settings.
  14. I have moved your thread to the AutoCAD Drawing Management & Output Forum. Hard to say without having the plotstyle to look at and the .dwg. True Colors will plot in color and so do color images, unless you set the printer's drivers to only plot in B&W. What exactly are you trying to plot "not in color"?
  15. Casusa

    Object not full copied.

    Hi. Solved using AutoCAD 2018. Copy Paste. Didn't try the other options. Thanks.
  16. Tharwat

    Add text to polyline vertexes

    Hi, Try this. (defun c:Test ( / pnt ltr) (setq ltr 64) (while (setq pnt (getpoint "\nSpecify a point :")) (entmake (list '(0 . "TEXT") (cons 10 (trans pnt 0 1)) (cons 40 (getvar 'TEXTSIZE)) (cons 7 (getvar 'TEXTSTYLE)) (cons 1 (chr (if (= (setq ltr (1+ ltr)) 91) (setq ltr 65) ltr)))) ) ) (princ) )
  17. Emmanuel Delay

    lisp request - send hatch to back in all blocks

    Yes, it works. I made it send every hatch to the back of the draw order (by ignoring the capa9 variable, which was only for 1 specific layer) Like this: Command HTB dwg as example, with a block "MyBlock" (SETQ *Doc* (VLA-GET-ACTIVEDOCUMENT(VLAX-GET-ACAD-OBJECT))) (DEFUN HatchToBackBlk (blk / od_blk od_ent blkname) (SETQ od_ent (TBLOBJNAME "BLOCK" (SETQ blkname (CDR (ASSOC 2 (ENTGET blk)))))) (WHILE (SETQ od_ent (ENTNEXT od_ent)) ;; (IF (EQ (CDR (ASSOC 8 (ENTGET od_ent))) capa9) (IF T (VL-CATCH-ALL-APPLY (FUNCTION (LAMBDA () (VLA-MOVETOBOTTOM (VLA-ADDOBJECT (VLA-GETEXTENSIONDICTIONARY (VLA-ITEM(VLA-GET-BLOCKS *Doc*) blkname)) "ACAD_SORTENTS" "AcDbSortentsTable") (VLAX-MAKE-VARIANT (VLAX-SAFEARRAY-FILL (VLAX-MAKE-SAFEARRAY VLAX-VBOBJECT '(0 . 0)) (LIST (VLAX-ENAME->VLA-OBJECT od_ent)))) ) ) ) ) ) ) (VLA-REGEN *Doc* 1) ) (defun c:htb ( / ) (HatchToBackBlk (car (entsel "\nSelect block: " ))) ) HatchToBackBlk.dwg
  18. amir0914

    Add text to polyline vertexes

    Thank you dlanorh, That's what I want, is that possible to add alphabet text by select vertex on one polyline ? maybe i won't add text to all vertexes, it means i want to select vertexes , then program add alphabet text for only my selected vertex on one polyline...is it possible??
  19. dlanorh

    Add text to polyline vertexes

    Tested and revised. (defun c:LPV ( / t_lst ent last_v e_pt s_pt cnt ) (setq t_lst (list "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "M" "N")) (cond ( (and (setq ent (car (entsel "\nSelect Polyline to Label : "))) (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") ) (setq last_v (vlax-curve-getendparam ent) e_pt (vlax-curve-getendpoint ent) s_pt (vlax-curve-getstartpoint ent) cnt 0.0 ) (if (equal e_pt s_pt 0.001) (setq last_v (1- last_v))) (while (<= cnt last_v) (entmakex (list (cons 0 "TEXT") (cons 7 (getvar 'textstyle)) (cons 40 (getvar 'textsize)) (cons 10 (vlax-curve-getpointatparam ent cnt)) (cons 1 (nth (fix cnt) t_lst)) ) ) (setq cnt (1+ cnt)) ) ) ) (princ) ) (princ)
  20. Ronjonp 1 question: The Lisp does not only the visability but also the rotation and the flip of the dynamic block. Can it be made that only the visability is copied tot the blocks (and attributes). JM
  21. Hey guys, I've been trying to plot a simple landscape drawing and the output of the drawing always shows in color. under 'Plot style table' - "print with plot styles" check box is checked.. i've uploaded some photos to help.
  22. dlanorh

    Add text to polyline vertexes

    Try this, down and dirty and NOT tested as I have No access to AutoCAD at the moment. (defun c:LPV ( / t_lst ent last_v cnt ) (setq t_lst (list "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" "K" "M" "N")) (cond ( (and (setq ent (car (entsel "\nSelect Polyline to Label : "))) (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") ) (setq last_v (vlax-curve-getendparam ent) cnt 0.0 ) (while (<= cnt last_v) (entmakex (list (cons 0 "TEXT") (cons 7 (getvar 'textstyle)) (cons 40 (getvar 'textsize)) (cons 10 (vlax-curve-getpointatparam ent cnt)) (cons 1 (nth (fix cnt) t_lst)) ) ) (setq cnt (1+ cnt)) ) ) ) (princ) ) (princ)
  23. Yesterday
  24. CyberAngel

    Object not full copied.

    My guess would be that your clipboard overflowed. That's a lot of data. From a data management standpoint, it would make sense to separate that "object" into several layers or areas and copy them in stages. Another obvious possibility is to xref the object. You can then bind it into the destination drawing. Or not. You mentioned making a block, did you try Wblock to export and then Block|Browse to import? In other words, create a third file as a staging area.
  25. amir0914

    Add text to polyline vertexes

    hi,,, all polyline have maximum 8 or 10 vertexes on my drawing.
  1. Load more activity
  • Newsletter

    Want to keep up to date with all our latest news and information?

    Sign Up
×