Jump to content

Search the Community

Showing results for tags 'block'.



More search options

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

  1. I have this block of text as you can see in the image below, and in the window show me this "VIGA V-SS01 (.25X .50)", BUT I DONT WANT THAT SHOW ME THIS. I want to the program ask me a question first, for example: What is the name? so I will set the answer of this question in the block I have. SO, I want to have this in the window "VIGA V- (AND THE ANSWER OF THE QUESTION)" EXAMPLE: Computer: What is the name? User write: L22 Then, that will show me: "VIGA V- L22" I will glad if you can help me, If you have already notice, I dont know to much about the topic.
  2. I have shared a Dynamic Block and you can download through the link below and also can watch video that demonstrate it how to use 2D dynamic block to develop a flat pattern of a cylinder that has been oblique Section. Dynamic Block Download Link
  3. I have a drawing that has two different blocks (see attached), what I needed to do was transfer over the attributes of one block over to the other (both have different tags). For example copying over attributes in "rev0_date" from the first block tag over to "revslot1date" in the second block tag , I ran across some code in the forums that did just that created by Lee Mac.The problem with it is it only transfers one attribute over, I modified it a little but its still not exactly what I need. The way it currently works is - It asks me to choose the first block with the attributes to copy, once selected it then asks me to choose the second block that will have the attributes pasted to it, once I've selected them, it then pastes the first specified tag attribute in the first block to the second, after that I have to repeat the process again, clicking the block with the attribute to copy and then choosing the second block to paste, I have to keep repeating these steps, clicking the first block then the second over and over until all the tag attributes have been copied over. My question is how can I stop having click the first and then second block over and over again for each tag and instead only have to go through the process once (click first block, then second and then transfer all the attributes over at once). Here is my current code (sorry if its a mess I'm very new to this): (defun c:blockswap ( / _SelectBlockWithTag a b des src tag ) (vl-load-com) (setq DAT1A "Rev0_Date" ; Source Attribute Tag 1 DES1A "Rev0_Desc" ; Source Attribute Tag 2 REV1A "Rev0" ; Source Attribute Tag 3 RDB1A "Rev0_Drawn_By" ; Source Attribute Tag 4 REV1B "RevSlot1Number" ; Destination Attribute Tag 3 DES1B "RevSlot1Description" ; Destination Attribute Tag 2 DAT1B "RevSlot1Date" ; Destination Attribute Tag 1 RDB1B "RevSlot1DrawnBy" ; Destination Attribute Tag 4 ) (defun _SelectBlockWithTag ( tag / e a ) (setq tag (strcase tag)) (while (progn (setvar 'ERRNO 0) (setq f (car (entsel (strcat "\nSelect Block with attribute " tag ": ")))) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, Try Again.") ) ( (not f) nil ) ( (and (eq "INSERT" (cdr (assoc 0 (entget f)))) (= 1 (cdr (assoc 66 (entget f)))) ) (if (not (setq z (vl-some (function (lambda ( x ) (if (eq tag (strcase (vla-get-tagstring x))) x) ) ) (vlax-invoke (vlax-ename->vla-object f) 'getattributes) ) ) ) (princ (strcat "\nBlock does not contain tag " tag ".")) ) ) ( (princ "\nInvalid Object Selected.") ) ) ) ) z ) (and (setq aa (_SelectBlockWithTag DAT1A)) (setq ab (_SelectBlockWithTag DAT1B)) ) (vla-put-textstring ab (vla-get-textstring aa)) (and (setq ba (_SelectBlockWithTag DES1A)) (setq bb (_SelectBlockWithTag DES1B)) ) (vla-put-textstring bb (vla-get-textstring ba)) (and (setq ca (_SelectBlockWithTag REV1A)) (setq cb (_SelectBlockWithTag REV1B)) ) (vla-put-textstring cb (vla-get-textstring ca)) (and (setq da (_SelectBlockWithTag RDB1A)) (setq db (_SelectBlockWithTag RDB1B)) ) (vla-put-textstring db (vla-get-textstring da)) (princ) ) drawing.dwg
  4. Dynamic Block of ASME B16.5 Flanges Rating 150# 300# 400# 600# 900# 1500# 2500# Sizes From 1/2" to 24" Watch The video of Dynamic Block Block https://www.youtube.com/watch?v=sdFtOPWggFo ASME B16.5 Flange Plan.dwg
  5. So the problem im having is i have code that runs to show the offset of measured points to design points, unfortunately the code works by inserting one of 4 predefined blocks for NSEW, or one of 4 when in 2 directions; only showing orthogonal distances. These work by passing through the distance to the block tag, and then comparing the EW, and/or NS values to determine the correct arrow direction to insert the correct block. What i want is instead of using orthogonal distances, is to have an arrow block within these blocks, that changes the direction of the arrow, based on a bearing that you pass through. eg if the horizontal distance between 2 points is 25mm at a bearing of 45 degrees, then a tag is created as per normal with 25 and an arrow point 45 degrees. Any good ideas? I've looked in the forums and couldn't find anything to solve this. Attached is an image of what i have currently made, note the aligned one showing 130mm is kinda what i want, but that arrow is not dynamic, it just goes left or right and the whole block is just rotated to show the bearing. It makes for a messy plan and a lot of neck craning to present to a client
  6. Hi, i need this block point. please see attached file.
  7. Hello, I am looking for a lisp that will allow me to increment an attribute in a block from one block to the next by doing a window selection. The lisp that I have now that I got from Chaitanya Chikkala (see below) works great, but I have to select each block individually. With 2000+ blocks it is easy to make a mistake. When I window select with it, it numbers them as they were added to the drawing. This does not work for me because multiple people work on drawings and then are combined into a master drawing so the order is wrong. Is there a way for a direction to be added, even if it is just along the x or y axis? Or is there a lisp that already does this? Any help is very much appreciated. (defun c:incr (/ ent obj x i ST_STR) (command "._undo" "_be") (SETQ ST_STR1 (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY ALPHABET/WORD)")) (SETQ ST_STR (GETSTRING "\nENTER STARTING NUMBER OF THE SEQUENCE(ANY INTEGER)")) (vl-load-com) (setq i 0) (prompt "\nSelect blocks one at a time and in order") (SETQ BLOCK_LIST (SSGET)) (SETQ BLOCK_LIST (FORM_SSSET BLOCK_LIST)) (while (< I (LENGTH BLOCK_LIST)) (SETQ ST_STR (STRCAT "" ST_STR)) (SETQ TEMP_ELE (NTH 0 (ATTRIBUTE_EXTRACT (NTH I BLOCK_LIST)))) (SETQ TEMP_ATTRIBUTE (STRCAT ST_STR1 ST_STR)) (SETQ TEMP_TAG (NTH 0 TEMP_ELE)) (MODIFY_ATTRIBUTES (NTH I BLOCK_LIST) (LIST TEMP_TAG) (LIST TEMP_ATTRIBUTE)) (SETQ ST_STR (ITOA (+ (ATOI ST_STR) 1))) (setq i (+ i 1)) ) (command "._undo" "_e") (princ)) (DEFUN FORM_SSSET (SSSET / I TEMP_ELE LIST1) (SETQ I 0) (SETQ TEMP_ELE NIL) (SETQ LIST1 NIL_) (WHILE (< I (SSLENGTH SSSET)) (SETQ TEMP_ELE (SSNAME SSSET I)) (SETQ LIST1 (CONS TEMP_ELE LIST1)) (SETQ I (+ I 1)) ) (REVERSE LIST1) ) (DEFUN ATTRIBUTE_EXTRACT (ENTNAME / ENT_OBJECT SAFEARRAY_SET I LIST1) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ LIST1 (CONS (LIST (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING") (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING") ) LIST1 ) ) (SETQ I (+ I 1)) ) (SETQ LIST1 (REVERSE LIST1)) (SETQ LIST1 (SORT_FUN LIST1 0 0))) (SETQ LIST1 NIL) )LIST1 ) (DEFUN MODIFY_ATTRIBUTES (ENTNAME IDENTIFIER VALUE / TEMP_ELE ENT_OBJECT SAFEARRAY_SET I J) (SETQ SAFEARRAY_SET NIL) (SETQ ENT_OBJECT ENTNAME) (SETQ ENT_OBJECT (VLAX-ENAME->VLA-OBJECT ENT_OBJECT)) (IF (= (VLAX-GET-PROPERTY ENT_OBJECT "HASATTRIBUTES") :VLAX-TRUE) (PROGN (SETQ SAFEARRAY_SET (VLAX-SAFEARRAY->LIST (VLAX-VARIANT-VALUE (VLAX-INVOKE-METHOD ENT_OBJECT "GETATTRIBUTES") ) ) ) (SETQ I 0) (SETQ J 0) (SETQ LIST1 NIL) (WHILE (< I (LENGTH SAFEARRAY_SET)) (SETQ TEMP_ELE (VLAX-GET-PROPERTY (NTH I SAFEARRAY_SET) "TAGSTRING")) (IF (/= (VL-POSITION TEMP_ELE IDENTIFIER) NIL) (PROGN (VLAX-PUT-PROPERTY (NTH I SAFEARRAY_SET) "TEXTSTRING" (NTH (VL-POSITION TEMP_ELE IDENTIFIER) VALUE)) )) (SETQ I (+ I 1)) ) ))) (DEFUN SORT_FUN (LIST1 FLAG1 FLAG2 /) (IF (= NIL (VL-CONSP (CAR LIST1))) (PROGN (SETQ LIST1 (INDEX_ADD LIST1)) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (CADR X) (CADR Y))) ) ) (SETQ LIST1 (MAPCAR '(LAMBDA (X) (CADR X)) LIST1)) ) (PROGN (IF (NOT (ATOM (NTH FLAG1 (NTH 0 LIST1)))) (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 (NTH FLAG1 X)) (NTH FLAG2 (NTH FLAG1 Y))) ) ) ) (PROGN (SETQ LIST1 (VL-SORT LIST1 '(LAMBDA (X Y) (< (NTH FLAG2 X) (NTH FLAG2 Y))) ) ) ) ) ) ) LIST1 )
  8. Need a small help to modify a lisp. The lisp attached here is working, Normally command 'CN' allow me to place a "CRBLK" block with incremental number for ATT TAG "00" as i click where i wants.later when using command "FCRT" i will get all the attributes tag value and Coordinates in a individual separate Tables (As Field text). Just need some small modifications to add another Attribute in same block with value "IL=00" which i can edit later by clicking on it (attribute editor). and later when using command "FCRT", it'll also gives the output as ATT tag values then coordinates then Second ATT Tag Value individual separate Tables. The existing lisp is working good, just needs some small modification, Though its a long lisp codes and i have no idea on this.. Have attached a screenshot, DWG and Lisp file for reference.. Thanks. here is the long lisp code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Title: Cordinates with Table ;; ;; Purpose: Numbering & create table ;; ;; Written: Bijoy Manoharan ;; ;; Command: CN, CSN, RES, CRT ;; ;; Date : Sep-2011 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Modifications: ;; ;; 1-fixed list sorting function ;; ;; 2-aded fields table command FCRT ;; ;; Written: Mahmoud Awad ;; ;; Date : Dec-2015 ;; ;; Mail :mmawad@ymail.com ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sub function error (defun trap1 (errmsg) (setvar "attdia" ad) (setvar "attreq" aq) (setq *error* temperr) (prompt "\n Enter Command CSN for Point Sub Numbering or CRT for Table") (princ) ) ;defun (defun trap2 (errmsg) (setvar "attdia" ad) (setvar "attreq" aq) (setq *error* temperr) (prompt "\n Enter Command CN to Continue Point Numbering or CRT for Table") (princ) ) ;defun (defun trap3 (errmsg) (setq *error* temperr) (prompt "\nCoordinate Table Command Cancelled") (princ) ) ;defun ;;-----------------------------------sub function to create block ;;;--- create block function start ----- (defun crb ( ) (if (not (tblsearch "BLOCK" "CRBLK")) (progn (if (not (tblsearch "STYLE" "Isocp")) (entmake (list (cons 0 "STYLE") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbTextStyleTableRecord") (cons 2 "Isocp") (cons 70 0) (cons 40 2.5) (cons 3 "Isocp.ttf") ) ) ) (entmake (list (cons 0 "BLOCK") (cons 8 "0") (cons 370 0) (cons 2 "CRBLK") (cons 70 2) (cons 4 "Block to Place Coordinate Points") (list 10 0.0 0.0 0.0) ) ) (entmake (list (cons 0 "CIRCLE") (cons 8 "0") (cons 370 0) (list 10 0.0 0.0 0.0) (cons 40 1.25) ) ) (entmake (list (cons 0 "ATTDEF") (cons 8 "0") (cons 370 0) (cons 7 "Isocp") (list 10 3.0 2.5 0.0) (list 11 3.0 2.5 0.0) (cons 40 2.5) (cons 1 "00") (cons 3 "Coordinate Point") (cons 2 "00") (cons 70 0) (cons 72 0) (cons 74 2) ) ) (entmake (list (cons 0 "ENDBLK") (cons 8 "0") ) ) ;;;--- To set block units in metre 70-6 ( (lambda ( lst ) (regapp "ACAD") (entmod (append (subst (cons 70 6) (assoc 70 lst) lst) (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) ) ) ) ) ) (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK"))))) ) ;;;--- To make block annotative ( (lambda ( lst ) (regapp "ACAD") (regapp "AcadAnnotative") (entmod (append (subst (cons 70 1) (assoc 70 lst) lst) (list (list -3 (list "ACAD" (cons 1000 "DesignCenter Data") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) (list "AcadAnnotative" (cons 1000 "AnnotativeData") (cons 1002 "{") (cons 1070 1) (cons 1070 1) (cons 1002 "}") ) ) ) ) ) ) (entget (cdr (assoc 330 (entget (tblobjname "BLOCK" "CRBLK"))))) ) ) ) ;;;--- to disable allow explod----- (vl-load-com) (setq BLOCKS (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object) ) ) BLK (vla-Item BLOCKS "CRBLK") ) (vla-put-explodable (vla-Item BLOCKS "CRBLK") :vlax-false) ;;;--- end to disable allow explod----- (princ) ) ;;;--- create function block end ----- ;;------------------------main functions------- (defun c:CN(/ num num1 pt ptlist name mh-text ad aq) (command "cmdecho"0) (setq clay (getvar "clayer")) (setq ad (getvar "attdia")) (setq aq (getvar "attreq")) (setq temperr *error*) (setq *error* trap1) (setvar "attdia" 0) (setvar "attreq" 1) ;;; input text name (if (not namef) (setq namef "")) (setq name (getstring (strcat "\nEnter prefix text <" namef ">: "))) (if (= name "") (setq name namef) (setq namef name)) ;;; input number (if (not nf-ns) (setq nf-ns 1)) ; default number (setq NUM (getreal (strcat "\nEnter point number : <" (rtos nf-ns 2 0) ">: "))) (if (not num) (setq num nf-ns) (setq nf-ns num)) ; to create new layer (if (not (tblsearch "layer" "Coordinate Points")) (command "-LAYER" "N" "Coordinate Points" "C" "7" "Coordinate Points" "LT" "Continuous" "Coordinate Points""LW" "0.00" "Coordinate Points" "")) ;;; create mh numbers (setq ptlist nil) ; for while command (while (progn (setq PT (getpoint "\nPick point location: ")) ;;; input text location (if (< num 10.0) (setq num1 (strcat "0" (rtos num 2 0)))) (if (>= num 10.0) (setq num1 (rtos NUM 2 0))) (crb) ;create block (setq mh-text (strcat name num1)) ; combine text into one variable (if (not (= pt nil)) (command "CLAYER" "Coordinate Points")) ;if (if (not (= pt nil)) (command "-insert" "CRBLK" pt "1" "1" "0" mh-text)) ;if (if (not (= pt nil)) (setvar "clayer" clay)) ;if (setq by (strcat (Chr 66)(Chr 73)(Chr 74)(Chr 79)(Chr 89)(Chr 183)(Chr 86)(Chr 183)(Chr 77))) (if (not (= pt nil)) (setq num (+ num 1))) ; for increment (if (not (= pt nil)) (setq suf (- num 1))) (if (not (= pt nil)) (setq nf-ns num)) (setq ptlist (append ptlist (list pt))) ; to stop while command ) ;progn ) ;while (setvar "clayer" clay) (princ) ) ;defun (defun c:CSN(/ numf snum sf-ss mh-text pt ptlist ptx pty name ad aq) (command "cmdecho"0) (setq clay (getvar "clayer")) (setq ad (getvar "attdia")) (setq aq (getvar "attreq")) (setq temperr *error*) (setq *error* trap2) (setvar "attdia" 0) (setvar "attreq" 1) ;;; input name (if (not namef) (setq namef "")) (setq name (getstring (strcat "\nEnter prefix text <" namef ">: "))) (if (= name "") (setq name namef) (setq namef name)) ;;; input number (if (not suf) (setq suf 1)) ; default number (setq NUMF (getreal (strcat "\nEnter point number : <" (rtos suf 2 0) ">: "))) (if (not numf) (setq numf suf) (setq suf numf)) ;;; input sub number (if (not sf-ss) (setq sf-ss 1)) ; default number (setq SNUM (getreal (strcat "\nEnter point subnumber : <" (rtos sf-ss 2 0) ">: "))) (if (not snum) (setq snum sf-ss) (setq sf-ss snum)) ;;; set arial.ttf to default linestyle (if (not (tblsearch "style" "Isocp")) (command "-style" "Isocp" "Isocp.ttf" 2.5 "1" 0 "n" "n")) ; to create new layer (if (not (tblsearch "layer" "Coordinate Points")) (command "-LAYER" "N" "Coordinate Points" "C" "7" "Coordinate Points" "LT" "Continuous" "Coordinate Points""LW" "0.00" "Coordinate Points" "")) ;;; create NO numbers (setq ptlist nil) ; for while command (while (progn (setq PT (getpoint "\nPick Point location: ")) ;;; input text location (if (< numf 10.0) (setq numf1 (strcat "0" (rtos numf 2 0)))) (if (>= numf 10.0) (setq numf1 (rtos numf 2 0))) (if (< snum 10.0) (setq snum1 (strcat "0" (rtos snum 2 0)))) (if (>= snum 10.0) (setq snum1 (rtos snum 2 0))) (crb) ;create block (setq mh-text (strcat name numf1 "-" snum1)) ; combine text into one variable (if (not (= pt nil))(command "CLAYER" "Coordinate Points")) (if (not (= pt nil))(command "-insert" "CRBLK" pt "1" "1" "0" mh-text)) (if (not (= pt nil))(setvar "clayer" clay)) (if (not (= pt nil))(setq snum (+ snum 1))) ; for increment (if (not (= pt nil))(setq nf-ns (+ numf 1))) (setq ptlist (append ptlist (list pt))) ; to stop while command ) ;progn ) ;while (princ) ) ;defun (defun c:RES () (setq namef "") (prompt "\nPrefix Text Variable Reseted") (princ) ) ;defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;---------- sub function for Table---------- (defun CRTable () (setq LEN (length CORDS)) ;(setq CORDS (acad_strlsort CORDS)) ;;;sorts list into order (setq CORDS (vl-sort CORDS '(lambda (x1 x2) (< (atoi x1) (atoi x2))))) ;;; sorts list into order NEW (setq CNT 0) (if (= (getvar "tilemode") 1) (setvar "tilemode" 0)) (command "pspace") (setq SP (getpoint "\nPick start point for table")) (setq ht 2.5) ;; text hieght (command "-style" "Isocp" "Isocp.ttf" 2.5 "1" 0 "n" "n") (if (not (tblsearch "layer" "Coordinate Table")) (command "-LAYER" "N" "Coordinate Table" "C" "7" "Coordinate Table" "LT" "Continuous" "Coordinate Table""LW" "0.00" "Coordinate Table" "")) (if (/= SP nil) ;;;checks for null input (progn (setq TXTX (car SP)) ;;;gets x coord of text start point (setq fx txtx) ;;; set first x value (setq TXTY (cadr SP)) ;;;gets y coord (setq fy TXTY) (setq encw 25.00) ; easting & northing Column width (setq nocw 20.00) ; number Column width (setq ten (/ encw 2)) (setq tno (+ (/ nocw 2) ten)) ;; place easting & northing text (entmake (list (cons 0 "text") (cons 1 "COORDINATES") (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list (+ TXTX 2.5) (+ TXTY (/ ht 2) (* ht 2)))) (cons 11 (list (+ TXTX 2.5) (+ TXTY (/ ht 2) (* ht 2)))) (cons 40 3.0) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "text") (cons 1 "POINTS") (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list (- TXTX tno) TXTY)) (cons 11 (list (- TXTX tno) TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "text") (cons 1 "EASTING") (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list TXTX TXTY)) (cons 11 (list TXTX TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "text") (cons 1 "NORTHING") (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list (+ TXTX encw) TXTY)) (cons 11 (list (+ TXTX encw) TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) ;; place easting & northing horizontal table lines (entmake (list (cons 0 "line") (cons 8 "Coordinate Table") (cons 10 (list (- TXTX (+ ten nocw)) (+ TXTY ht))) (cons 11 (list (+ TXTX ten encw) (+ TXTY ht))) ) ) (entmake (list (cons 0 "line") (cons 8 "Coordinate Table") (cons 10 (list (- TXTX (+ ten nocw)) (- TXTY ht))) (cons 11 (list (+ TXTX ten encw) (- TXTY ht))) ) ) (repeat LEN (setq TXTY (- TXTY (* 2 HT))) ;;;set new y coord for text (setq SP (list TXTX TXTY)) ;;;creates code start point (setq CORD (nth CNT CORDS)) ;;;gets coord from list (setq COLEN (strlen CORD)) ; (setq COM 1 GAP 1) (while (/= COLEN COM) ; (setq COM1 (substr CORD COM 1)) ;finds ',' in strings for (if (and (= COM1 ",") (= GAP 1)) (setq S1 COM GAP 2)) ;spliting string (if (and (= COM1 ",") (= GAP 2)) (setq S2 COM)) ; (setq COM (+ COM 1)) ; ) ;while (setq CODE (substr CORD 1 (- S1 1))) ;;;strips of code (setq SON (substr CORD (+ S1 1) (- S2 S1 1))) ;;;strips of north (setq SOE (substr CORD (+ S2 1) (- COLEN S2))) ;;;strips of east (entmake (list (cons 0 "text") (cons 1 code) (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list (- TXTX tno) TXTY)) (cons 11 (list (- TXTX tno) TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "text") (cons 1 soe) (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list TXTX TXTY)) (cons 11 (list TXTX TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "text") (cons 1 son) (cons 7 "Isocp") (cons 8 "Coordinate Table") (cons 10 (list (+ TXTX encw) TXTY)) (cons 11 (list (+ TXTX encw) TXTY)) (cons 40 ht) (cons 50 0.0) (cons 72 4) ) ) (entmake (list (cons 0 "line") (cons 8 "Coordinate Table") (cons 10 (list (- TXTX (+ ten nocw)) (- TXTY ht))) (cons 11 (list (+ TXTX ten encw) (- TXTY ht))) ) ) ;; horizontal lines (setq hl (entlast)) ; set hl as last horizontal line (setq CNT (+ CNT 1)) ) ;repeat (setq ly (caddr (assoc 10 (entget hl)))) ;set last y value ;; place easting & northing vertical table lines (entmake (list (cons 0 "line") (cons 8 "Coordinate Table") (cons 10 (list (- fx ten) (+ fy ht))) (cons 11 (list (- fx ten) ly)) ) ) (entmake (list (cons 0 "line") (cons 8 "Coordinate Table") (cons 10 (list (+ fx ten) (+ fy ht))) (cons 11 (list (+ fx ten) ly)) ) ) (entmake (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 "Coordinate Table") (cons 90 4) (cons 70 1) (cons 10 (list (- fx (+ ten nocw)) (+ fy (* ht 4)))) (cons 10 (list (+ fx (+ ten encw)) (+ fy (* ht 4)))) (cons 10 (list (+ fx (+ ten encw)) ly)) (cons 10 (list (- fx (+ ten nocw)) ly)) ) ) ; inner rectangle (entmake (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 8 "Coordinate Table") (cons 90 4) (cons 70 1) (cons 10 (list (- fx (+ ten nocw 1)) (+ fy (* ht 4) 1))) (cons 10 (list (+ fx (+ ten encw 1)) (+ fy (* ht 4) 1))) (cons 10 (list (+ fx (+ ten encw 1)) (- ly 1))) (cons 10 (list (- fx (+ ten nocw 1)) (- ly 1))) ) ) ; outer rectangle (command "erase" hl "") ) ; progn ) ;if (command "redraw") (princ) ) ; defun ;;-------------Main function to make List of points----- (defun c:CRT (/ txtx txty len cord cords cnt sp ht code son soe sox soy so1 encw nocw ten tno lat hl ly fx fy) (setvar "cmdecho" 0) (setq temperr *error*) (setq *error* trap3) (setq CORDS nil LEN nil CNT 0) ;;resets coord list to nil (princ (strcat "\n ")) (initget 1 "All Select") (setq sel (strcase (getkword "\Select individual coordinate points or Select All (S or A): "))) (if (= sel "SELECT") (setq SS (ssget '((2 . "crblk")))) (setq SS (ssget "X" '((2 . "crblk"))))) (command "UCS" "WORLD") (while (/= SS nil) ;;;checks for nil selection (setq LEN (sslength SS)) (repeat LEN (setq SO0 (ssname SS CNT)) (setq CORD (cdr (assoc '10 (entget SO0)))) ;;;gets coords of point (setq SOX (rtos (car CORD) 2 3)) ;;;strips off X coord (setq SOY (rtos (cadr CORD) 2 3)) ;;;strips off Y coord (setq SO1 (entnext SO0)) ;;;gets attribute entity (setq CODE (cdr (assoc '1 (entget SO1)))) ;;;strips off point code from attribute (setq CORD (strcat CODE "," SOY "," SOX)) ;;;creates string of code,y,x (setq CORDL (list CORD)) ;;;converts into list (if (= CORDS nil) (setq CORDS CORDL) (setq CORDS (append CORDL CORDS))) ;;;starts new list or adds to old (setq CNT (+ CNT 1)) ) (setq SS nil) ;;;finishes loop ) ;while (command "UCS" "P") (if (/= (length CORDS) 0) (CRTable)) (setq *error* temperr) (prompt "\n Coordinate Table is Placed\n © Bijoy Manoharan 2011 www.cadlispandtips.com") (princ) ) ;defun ;;------------- end Main function -------------------- ;;-------------Main function to make List of points by fields and in reail table----- (defun c:FCRT (/ e n blk corlis txtx txty len cord cords cnt sp ht code son soe sox soy so1 encw nocw ten tno lat hl ly fx fy) (setvar "cmdecho" 0) (setq temperr *error*) (setq *error* trap3) (setq CORDS nil LEN nil CNT 0) ;;resets coord list to nil (princ (strcat "\n ")) (initget 1 "All Select") (setq sel (strcase (getkword "\Select individual coordinate points or Select All (S or A): "))) (if (= sel "SELECT") (setq SS (ssget '((2 . "crblk")))) (setq SS (ssget "X" '((2 . "crblk"))))) (command "UCS" "WORLD") (if (/= SS nil) (repeat (setq n (sslength ss)) (setq blk (ssname ss (setq n (- n 1)))) (setq corlis (cons (list (cdr (assoc '1 (entget (entnext blk)))) (strcat "%<\\AcObjProp Object(%<\\_ObjId " (ObjectID (vlax-ename->vla-object (entnext blk))) ">%).TextString>%") (strcat "%<\\AcObjProp Object(%<\\_ObjId " (ObjectID (vlax-ename->vla-object blk)) ">%).InsertionPoint \\f \"" "%lu2%pt1%pr3" "\">%") (strcat "%<\\AcObjProp Object(%<\\_ObjId " (ObjectID (vlax-ename->vla-object blk)) ">%).InsertionPoint \\f \"" "%lu2%pt2%pr3" "\">%") ) corlis ) ) ) ) (if (> (setq n (length corlis)) 0) (progn ;(setq n (+ n 1)) (setq corlis (vl-sort corlis '(lambda (x1 x2) (< (if (> (atoi (car x1)) 0) (atoi (car x1)) (car x2)) (if (> (atoi (car x2)) 0) (atoi (car x2)) (car x2)))))) (initget 1) (setq pt (getpoint "\nSelect point for table: ")) (foreach li corlis (if (not e) (setq e pt) (setq e (list (+ (car e) (vla-get-width tap) 3) (cadr e) (caddr e)))) (command "-TABLE" 1 3 e) (setq tap (vlax-ename->vla-object (entlast))) (vla-SetText tap 0 0 (strcat "BEND - " (nth 1 li))) (vla-SetText tap 2 0 (strcat "E=" (nth 2 li))) (vla-SetText tap 3 0 (strcat "N=" (nth 3 li))) ) ) ) (command "UCS" "P") (setq *error* temperr) (prompt "\n Coordinate Table is Placed") (princ) ) ;defun (defun ObjectID ( obj ) (eval (list 'defun 'ObjectID '( obj ) (if (and (vl-string-search "64" (getenv "PROCESSOR_ARCHITECTURE")) (vlax-method-applicable-p (vla-get-utility (acdoc)) 'getobjectidstring) ) (list 'vla-getobjectidstring (vla-get-utility (acdoc)) 'obj ':vlax-false) '(itoa (vla-get-objectid obj)) ) ) ) (ObjectID obj) ) (defun acdoc nil (eval (list 'defun 'acdoc 'nil (vla-get-activedocument (vlax-get-acad-object)))) (acdoc) ) ;;------------- end Main function -------------------- ATT Cordinates IN Table - CN,FCRT.LSP Drawing - Copy111.dwg
  9. I've been looking for a routine that will allow me to transfer an attribute from one block to another. Ideally I'd like to click on one block which contains the attribute I want (from a field called ID_1), then click on another block and copy the attribute to another specific field (ID_2). I need to do this to quite a few blocks so I'd like to just continue to click between the two types of block. I thought I could modify the code on this page http://www.cadtutor.net/forum/showthread.php?32085-Need-Lisp-to-update-attributes, but this appears to place the same attribute on every block I click. Any help is greatly appreciated!
  10. Hello, I apologize if my terminology is off as I generally do not work in CAD/LISP. I am working on a lisp routine that draws blocks and adds attributes to the blocks (labels). I set the blocks to be a solid hatch and set their colour with (setvar "cecolor" "255"). After I finished I realized it would be nice to add the ability to draw the blocks without fill if the user wishes. I thought their would be a system variable something like (setvar "transparency" "100") but I can't find anything. Does anyone know how to set the transparency of block fill using LISP or how to set the colour to NULL? Thanks
  11. Good morning all, I am trying to create a linetype that uses a polyline/block to create a series of thicker arrows. I have written: *DIVERSION,DIVERSION DRAIN -----> -----> A,.982117,-.256835,[DIVERSION,DIVERSION.SHX,X=0,S=.25].977201 But it does not seem to work just comes out as a series of dashes. I have attached a few things that may help. Cheers Allison DIVERSION.lin DIVERSION.shp DIVERSION.shx
  12. I want to change the text "A" in my dynamic block to "B,C,D,E,..." When i click on a blue arrow. and the text "16 A" to "20 A , 25 A, ..." When i click on another blue arrow. what is the best way to do this ?
  13. 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.
  14. I have a block with about 60 single-line text entities, 40 of which have a place holder character that needs to change based on how the block is used. For example, "~1a" and "~1b" need to change to "P1a" and "P1b", where "~" is the place holder and "P" is the letter for this 1 block. The next instance of the same block will need a different letter. This is not a good application for attributes. I found Lee Mac's LISP c:ReplaceBlockText in this thread using vlax-for, but it appears to work on the block definition and changes the text for every instance of the block in the drawing. I need this to work on 1 selected instance of the block. Any help is appreciated, even if it's a point in the right direction.
  15. Hello, In this DWG i need to pair text (which is room function) with block attribute "FUNCTION" that i've created. I can do this manually but it's over 1000 blocks ,so that make me wonder is it possible to create LISP which take nearest text into block attribute. I've found that LISP (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/add-text-value-to-a-block-attibute/td-p/7949545) but it's swaping texts over rooms for example in room where laboratorium is located it name it biuro which is located next to it. Sorry for my plain english, I'm not native speaker. Thanks in advance! test_1.dwg
  16. samifox

    protecting dynamic blocks

    Hi i want to develop commercial dynamic blocks, is there a way to protect them against piracy? Thanks S
  17. Good morning, I've created quite a number of tool palettes, including nine palette groups, and everything has been working great. Now, of a sudden, I can't drag and drop any type of entity into an new, empty palette. I can still load whatever I want into an existing one, but nothing into a new one. I've created the palette both through the palette itself and through the adcenter, but nothing works. Anyone have thoughts? Thanks, Tom
  18. Apologies if this is asked and answered. I can't find it. I have a dynamic block that is fairly complex. I select it to highlight the grips, I pull a stretch grip up. The block looks horrible, things that are supposed to stretch don't. Or what's almost worse is 1/2 of a line will stretch. I then leave the block highlighted and type "bedit" and the command line. When the editor selector opens, the block is already highlighted because I left it highlighted. I enter the editor. Here's the weird/magic part. I need to change something. Anything, no matter how small. I've learned that all I have to do is change the zoom - so I give my scroll wheel a little 'flick'. Then I close the editor with changes saved. When the block in the drawing reappears, it's perfect. Not ugly any more, all the issues have corrected themselves. I believe several of my more complex dynamic blocks all do this. Attached is a gif with a visual of the above description. I've also attached the block itself. This has been going on for years, I upgrade each year with the hopes it is resolved. Right now I'm on 2018. I believe I tried 2019 last spring, but now I'm not sure I remember that properly. It happens on my computer, as well as at least 4 other computers attempted by co-workers. And it doesn't happen every time, it's almost like a setting in the drawing it's inserted into. However, every one of our drawings starts from the same template file. Any help or insight is appreciated. Thanks in advance. 1-Line Inverter Hor w AIC.dwg
  19. Hi. Maybe someone here in this forum can help me. I'm trying to set the distance for a dynamic block of a single parameter; which is linear and is called Distance1. I do not know what I'm doing wrong, but I can not do it and change the desired distance. He helped me with the functions of Lee Mac, but something is wrong. Any help very similar, I will be completely grateful. (defun c: ddd (/ obj dd) (if (y (setq obj (car (entsel "\ ndynamic block:") (setq dd (getdist "\ Length:")))) (= "AcDbBlockReference" (vla- get-objectname (setq obj (vlax-esame-> vla-object obj)))) (=: vlax-true (vla-get-isdynamicblock obj)) ) (LM: setdynpropvalue obj "Distance1" dd) ) (princ) ) (defun LM: setdynpropvalue (blk prp val) (setq prp (strcase prp)) (vl-some '(lambda (x) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla- put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) (cond (val) (t)) ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) (vl-load-com) (princ)
  20. Good morning everyone, I am currently working on a dynamic block to show the level of a point in a sectional drawing. As you see on the picture, the base of the block is placed on the zero level and the triangle with the value can be moved to any point of the drawing and retrieves the Y-Value of this little yellow circle object representing the level of this point. What I am trying to do now, is to use a diesel expression to add a "+" for a positive value and a "%%P" for a value of zero. What I have now appears to be working, but does not update dynamically when I move the level-mark. Any ideas on what I have to change or if this is possible at all? Any help appreciated. Here is the expression I am using now: $(if,$(EQ,$(=,%%).Center \f "%lu2%pt2%pr2">%,0),1),"%%p",$(if,$(EQ,$(>,%%).Center \f "%lu2%pt2%pr2">%,0),1),"+"," "))%%).Center \f "%lu2%pt2%pr2">%
  21. Hi everybody. Here goes my first post. I'm using Autocad map 3D 2013. I dont know how to create any lisps. Thank you for any help, any is really appreciated since that i know that is really taking some of your time. I have a .dwg file with a lot of GPS points, that were taken from the field and uploaded to our systems. The GPS points come in as blocks with attributes, Im want some of does attributes to be in a multi leader (The text area). Is easy for me to replace the GPS points (Blocks) with a multileader that I created as a block, in which the arrow points exactly to where the gps point was located. I use the xpress tools to replace one block for another, since that all corresponding blocks are named the same, only the attributes change, so basically the multileader now is the GPS point. The GPS has two attributes that I need. Clearance_Ft=18.5 and crossing type= driveway or anything that we are crossing. I can also get the actual attributes Clearanace and Crossing type in a text form if I do a querry of the data. After I replace the point with a multileaders I try to insert fields in to the multileader to pick up it's own attributes, that didn't work, because since that I'm inside the block multileader when I press to insert the info that I need, the attributes disappear and is just a multileader inside block editor. I try Concatenation of Block Attributes, and it didnt work, at one point the insert field it did work but it was giving me the same clearance for all the points, Lol. I knew it was wrong. If I can get this issue resolve it would save me hours of work since that, for now I have to type every clearance by hand. When i mentioned the part that i can get the info out of the point as a text is because maybe you guys do have a better idea of how to solve the problem. Again Thank you. sample.dwg
  22. Hello Guys, I have a doubt, someone knows if has some Lisp to get the last digits (specified - user input) of a dwg file name (in Windows explorer) and write it on a specific attribute name on a internal block. Eg.: I have a folder with 600 pages dwg files, so, the last numbers of it is a specific item to show the page number of that file, it's possible read these numbers and write in an attribute inside dwg to correct the page index.
  23. All, I've been using Lee Mac's "Add object to block" lisp for sometime now and it works great, and one of the things I use it for is my title block for revisions but now the revision block has been inserted into the title block as a block and it won't add what I want to the revision block. Is there a way to make it find the revision block inside of the title block? Basically I would to able to pick the block inside of a block. ;;----------------=={ Add Objects to Block }==----------------;; ;; ;; ;; Adds all objects in the provided SelectionSet to the ;; ;; definition of the specified block. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; doc - Document Object in which block resides. ;; ;; block - Entity name of reference insert ;; ;; ss - SelectionSet of objects to add to definition ;; ;;------------------------------------------------------------;; (defun LM:AddObjectstoBlock ( doc block ss / lst mat ) (setq lst (LM:ss->vla ss) mat (LM:Ref->Def block) mat (vlax-tmatrix (append (mapcar 'append (car mat) (mapcar 'list (cadr mat))) '((0. 0. 0. 1.)))) ) (foreach obj lst (vla-transformby obj mat)) (vla-CopyObjects doc (LM:SafearrayVariant vlax-vbobject lst) (vla-item (vla-get-Blocks doc) (cdr (assoc 2 (entget block)))) ) (foreach obj lst (vla-delete obj)) (vla-regen doc acAllViewports) ) ;;-----------------=={ Remove From Block }==------------------;; ;; ;; ;; Removes an Entity from a Block Definition ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; ent - Entity name of Object to Delete from Block [ENAME] ;; ;;------------------------------------------------------------;; (defun LM:RemovefromBlock ( doc ent ) (vla-delete (vlax-ename->vla-object ent)) (vla-regen doc acAllViewports) (princ) ) ;;------------------=={ Safearray Variant }==-----------------;; ;; ;; ;; Creates a populated Safearray Variant of a specified ;; ;; data type ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; datatype - variant type enum (eg vlax-vbDouble) ;; ;; data - list of static type data ;; ;;------------------------------------------------------------;; ;; Returns: VLA Variant Object of type specified ;; ;;------------------------------------------------------------;; (defun LM:SafearrayVariant ( datatype data ) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray datatype (cons 0 (1- (length data)))) data ) ) ) ;;------------=={ SelectionSet -> VLA Objects }==-------------;; ;; ;; ;; Converts a SelectionSet to a list of VLA Objects ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; ss - Valid SelectionSet (Pickset) ;; ;;------------------------------------------------------------;; ;; Returns: List of VLA Objects, else nil ;; ;;------------------------------------------------------------;; (defun LM:ss->vla ( ss / i l ) (if ss (repeat (setq i (sslength ss)) (setq l (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) l)) ) ) ) ;;---------------=={ Block Ref -> Block Def }==---------------;; ;; ;; ;; Returns the Transformation Matrix and Translation Vector ;; ;; for transforming Block Reference Geometry to the Block ;; ;; Definiton. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; e - Block Reference Entity ;; ;;------------------------------------------------------------;; ;; Returns: List of 3x3 Transformation Matrix, Vector ;; ;;------------------------------------------------------------;; (defun LM:Ref->Def ( e / _dxf a l n ) (defun _dxf ( x l ) (cdr (assoc x l))) (setq l (entget e) a (- (_dxf 50 l)) n (_dxf 210 l)) ( (lambda ( m ) (list m (mapcar '- (_dxf 10 (tblsearch "BLOCK" (_dxf 2 l))) (mxv m (trans (_dxf 10 l) n 0) ) ) ) ) (mxm (list (list (/ 1. (_dxf 41 l)) 0. 0.) (list 0. (/ 1. (_dxf 42 l)) 0.) (list 0. 0. (/ 1. (_dxf 43 l))) ) (mxm (list (list (cos a) (sin (- a)) 0.) (list (sin a) (cos a) 0.) (list 0. 0. 1.) ) (mapcar '(lambda ( e ) (trans e n 0 t)) '( (1. 0. 0.) (0. 1. 0.) (0. 0. 1.) ) ) ) ) ) ) ;; Matrix x Vector - Vladimir Nesterovsky (defun mxv ( m v ) (mapcar '(lambda ( r ) (apply '+ (mapcar '* r v))) m) ) ;; Matrix x Matrix - Vladimir Nesterovsky (defun mxm ( m q ) (mapcar (function (lambda ( r ) (mxv (trp q) r))) m) ) ;; Matrix Transpose - Doug Wilson (defun trp ( m ) (apply 'mapcar (cons 'list m)) ) ;;---------------------=={ Select if }==----------------------;; ;; ;; ;; Provides continuous selection prompts until either a ;; ;; predicate function is validated or a keyword is supplied. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - [url="http://www.lee-mac.com"]www.lee-mac.com[/url] ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; msg - prompt string ;; ;; pred - optional predicate function [selection list arg] ;; ;; func - selection function to invoke ;; ;; keyw - optional initget argument list ;; ;;------------------------------------------------------------;; ;; Returns: Entity selection list, keyword, or nil ;; ;;------------------------------------------------------------;; (defun LM:SelectIf ( msg pred func keyw / sel ) (setq pred (eval pred)) (while (progn (setvar 'ERRNO 0) (if keyw (apply 'initget keyw)) (setq sel (func msg)) (cond ( (= 7 (getvar 'ERRNO)) (princ "\nMissed, Try again.") ) ( (eq 'STR (type sel)) nil ) ( (vl-consp sel) (if (and pred (not (pred sel))) (princ "\nInvalid Object Selected.") ) ) ) ) ) sel ) ;-------------------------------------------------------------; ; -- Test Functions -- ; ;-------------------------------------------------------------; (defun c:Add2Block ( / *error* _StartUndo _EndUndo acdoc ss e ) (defun *error* ( msg ) (if acdoc (_EndUndo acdoc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc) (vla-StartUndoMark doc) ) (defun _EndUndo ( doc ) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-EndUndoMark doc) ) ) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (and (setq ss (ssget "_:L")) (setq e (LM:SelectIf "\nSelect Block to Add Objects to: " '(lambda ( x ) (eq "INSERT" (cdr (assoc 0 (entget (car x)))))) entsel nil ) ) ) (progn (_StartUndo acdoc) (LM:AddObjectstoBlock acdoc (car e) ss) (_EndUndo acdoc) ) ) (princ) ) ;-------------------------------------------------------------; (defun c:Remove ( / *error* _StartUndo _EndUndo acdoc e ) (defun *error* ( msg ) (if acdoc (_EndUndo acdoc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc) (vla-StartUndoMark doc) ) (defun _EndUndo ( doc ) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-EndUndoMark doc) ) ) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (while (setq e (car (nentsel "\nSelect Object to Remove: "))) (_StartUndo acdoc) (LM:RemovefromBlock acdoc e) (_EndUndo acdoc) ) (princ) ) (vl-load-com) (princ) ;;------------------------------------------------------------;; ;; End of File ;; ;;------------------------------------------------------------;;
  24. Hi All Im sitting with at little quistion, because I have alot of dwg's with different blocks in them. I now need to change one specific block with another block. Since I have around 100 drawings where I have to change the block then I was hoping that there would be an easy way so I don't have to go in manually in each dwg. Can you help me or give me some hints on how to do this? FYI: I can not change the old block in block editor because I still need it.
  25. I made a Block Library with 4 objects in it, which I proceeded to insert into a drawing. However, only 2/4 of the objects inserted. The layers are not frozen, locked, or invisible. I've attached two screenshots. Please help me! I've been messing with this for hours.
×
×
  • Create New...