Jump to content

Search the Community

Showing results for tags 'fields'.

  • 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...

  1. Hello, I have some title blocks and PO sheets that contain company information like address, phone, etc. However, in my company the CAD for all branches is done in one location, so this information will need to change depending on which branch the project is for. Right now we use DWGPROPS to fill out job specific information such as JobName, Client, SiteAddress, etc. I would like to include the "Branch Name" in here as well (ie. Vancouver, Calgary, etc), with other fields referencing this entry to fill out the office phone, address, fax, etc, so that we don't need to fill in all of that info manually for every new project. However, I can't find any way to use a custom property in a conditional, ie, something like: if CustomDP.Branch=="CALGARY" then [Phone number]="XXX-XXX-XXXX", elseif CustomDP.Branch=="VANCOUVER" then [Phone number]="YYY-YYY-YYYY" It seems that a "formula" field is able to include nested fields, but is unable to handle conditional statements or branching paths. A DIESEL expression may work, but seems to be completely unable to reference custom DWGPROPS. DIESEL seems unable to reference object properties either, so I also can't do an intermediate attribute that is then referenced by a DIESEL expression. Is there any way to get this functionality? If possible I would really prefer to do it with fields or with some other method that stays self-contained within the template drawing, rather than requiring me to run VB code on every CAD machine in the office. Right now my workaround is is to rename the user profile with the branch name, as that is an easily editable acad variable that is accessible by DIESEL. It kind of works but the issue is that the profile name is global, not saved per project, so I often see POs going out with the wrong "Ship To" address when guys forget to change their profile between projects. Thanks,
  2. Hello, I have created a table within AutoCAD. I have written some words in cell "A1", I would like to display the same words in another cell using an equation "=A1". When I type the "=A1" equation the cell displays "####" Is there anyway to make this work? possibly using fields? Thanks
  3. I have several blocks that have fields created withing them, when I insert the block into a drawing then go to Drawing Utilities -> Drawing Properties those fields are not in the list to edit. I know how to go through the tedious steps of manually re-entering every single field but wondered if there is a way to get those fields to "add automatically" upon insertion into the drawing. Please advise.
  4. Hello, I have two reactor and two problems in callback functions. I have inserted same princ to be evident where is the error. Outside (from CallBack func reactors) they works properly. It seems that some LISP function are not compatibile to work in callback func (vlax-ename->vla-object, vla-update). My callback func.: - AppendBkAreaLst - when I copy an object included in _AreaBkLst, must add the new one to reactors : execution broke on line :(setq obL(vlax-ename->vla-object(entlast))) : message> 1 <Entity name: 1edac8b6420>2 ; error: Automation Error. Description was not provided. - CopyAreaBkReactor - when I modify a DynBlk parameters, update the area field attribute : execution broke on line: (vla-update ob) : message>!begin! ; error: Automation Error. Object was notifying : although, the field are updated, but report an error _AreaBkLst - global var - a lst with dyn blks ;------------Setup Reactors----------- (setq ModifyAreaBkReactor (vlr-object-reactor _AreaBkLst "ModifyAreaBkReactor" '((:vlr-modified . UpdateBkArea)))) (setq CopyAreaBkReactor (vlr-object-reactor _AreaBkLst "CopyAreaBkReactor" '((:VLR-copied . AppendBkAreaLst)))) ;------------Functions---------------- (defun AppendBkAreaLst (ob re Rlst / obL) ;at >COPY add new Blk to reactor /Callback fun (princ "1 ") (princ(entlast)) (princ "2 ") (setq obL(vlax-ename->vla-object(entlast))) (princ "3 ") (vlr-owner-add ModifyAreaBkReactor obL) (vlr-owner-add CopyAreaBkReactor obL) (princ)) (defun UpdateBkArea (ob re Rlst / ) ;when modify parameters- update area field /Callback fun (setq BC(BlockComponents (vla-get-name ob) "")) (setq obS(vlax-ename->vla-object (nth 5 bc))) (setq Area (vlax-curve-getarea(car BC))) (vla-put-TextString obS Area) (princ "\n!begin! ") (vla-update ob) (princ "ok")(princ)) (defun BlockComponents ( blk typ / ent lst ) ;lst all enteies inside blk (setq typ (strcat typ "*")) (if (setq ent (tblobjname "block" blk)) (while (setq ent (entnext ent)) (if (wcmatch (cdr (assoc 0 (setq enx (entget ent)))) typ) (setq lst (cons ent lst))))) (reverse lst))
  5. Hey Guys, I have created a bunch of lisp variables that look something like this "StageArea1", "StageArea2", ect What im wanting to do is create a field formula that links to these variable, but i want whatever area value it calls to be determined by the contents of a piece of text. My initial thoughts where something like this(or some variation of it): %<\AcVar.17.0 Lisp.StageArea(%<\AcObjProp Object(%<\_ObjId 2228256557344>%).TextString>%)>% With %<\AcObjProp Object(%<\_ObjId 2228256557344>%).TextString>% calling the contents of my piece of text, but this doesn't seem to work when i plug it into a Formula inside the field dialog box. Does anyone have any other ideas on how to do this?
  6. 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
  7. Hello all, I have posted as a reply on other post to try and find a way to make what seems to be impossible...possible...First and foremost...I KNOW THE EXACT EQUIVALENT OF SQUAT!! about writing, reading, or understanding LISP or the verbiage associated with it. That being said, I would like to know in the most simplistic of terms, how to change the visibility state of a dynamic block using a field that is referenced from an Excel sheet. Here are the steps that I would like to take in order for what I want to accomplish to happen: open excel file input visibility state data for the block in a designated cell save the excel file open the AutoCAD dwg print (and have the block associated with the Excel input displaying the correct visibility state) I have attached a very simple block and excel sheet with this message, in the excel sheet I have copied the block information from the various visibility states using the LIST command in AutoCAD. I am currently using AutoCAD Mechanical 2018, but this block was made in AutoCAD Mechanical 2016. Here is a code that I copied from a very knowledgeable resource on LISP routines, Mr. Lee Mac, which I am sure that most of you have heard of. ;; Set Dynamic Block Visibility State - Lee Mac ;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed) ;; blk - [vla] VLA Dynamic Block Reference object ;; val - [str] Visibility State Parameter value ;; Returns: [str] New value of Visibility Parameter, else nil (defun LM:SetVisibilityState ( blk val / vis ) (if (and (setq vis (LM:getvisibilityparametername blk)) (member (strcase val) (mapcar 'strcase (LM:getdynpropallowedvalues blk vis))) ) (LM:setdynpropvalue blk vis val) ) ) My problem is the utterly embarrassing lack of knowledge when it comes to LISP code, so I have absolutely NO idea as to how to utilize or implement his program, what variables to change to fit my drawing or how to make it reference the field or Excel sheet. So any help would be greatly appreciated, and please, feel free to assume that you are talking to a complete idiot on the subject of LISP, because you are, and feel free to explain even OVER explain in detail the changes that I need to make in order to make this little bit of happiness work for me. Thank you in advance for all of those that have taken the time to read this, and have input to share. Thank you, Jetxcc
  8. Hello everybody, This is my first post on CADTutor. I've been reading alot here even before I became a member, but it is time for me to join the community with a question since I cannot find the exact answer to mine. Question: Is it possible to sum numbers in Mtext fields created with lisps? AT.LSP OT.LSP I edited them to suit my needs with prefix and suffix and decimal precision (they are in the core the same, originally made by JTB), one is displaying area of selected polyline (AT.lsp) and the other perimeter/length (OT.lsp). I would like to preserve possibility of field updating so when polyline/area is changed I just enter regenall. I copied Mtext fields maually to "oldstyletable" made from lines and mtext, mtext fields. See attached dwg for example. I've seen this thread: http://www.cadtutor.net/forum/showthread.php?43699-Sum-Text-Strings-to-Text-Field... I tried all the lisps but none are applicable to my problem. I get only #### even after regen (I think it's maybe because of prefix and suffix, but don't know). I've managed to work only with text and then my updating Mtext fields are, for sure, gone. Please advise. TEST1.dwg
  9. Hey guys, So, is it possible to have a lisp that automatically labels a block based on an attribute? Ideally, it would also be a field so that if the attribute changed, the mulitleader text would as well. For example, let's say I have a dynamic block for an Oak Tree, which has three sizes: 2", 3", & 4". It'd be great if I could run a LISP that would create a multileader that read " 2"-Oak Tree ". It'd be doubly great if the 2" part of that was a field that updated if the dynamic block was changed to its 4" state. For reference, this wonderful Lee Mac LISP is what I currently use for my labeling and it's brilliant. Ideally, I'll end up combining the attribute/field labeling component with this lisp somehow. Lastly, I'm not great at all with writing LISPs, but I'd like to figure out how this one would work so that I can modify it as need be on my own. Thanks for any help!
  10. Hi all, I have been tasked with coming up with a dynamic block that is for a chute. It is a simple rectangle that I've added some attributes to and a field within one of the attributes. What I need the formula to do is calculate the angle of the chute based on user input for the upper height and the lower height (rise) and "Distance 1" (run) and then return the answer in the field. It returns the correct angle on insertion, however, when I change any of the values and Regen the result is incorrect. In addition, I would like the "Angle" attribute to not show in the dialog box when inserted. Is that possible? Thanks. Chute plan view.dwg
  11. Hi All, i'm trying to make a new linetype with text, but i want the text to have a field that displays the length of the line. Does anyone know how to do this? Or if it's possible? Any help would be much appreciated!
  12. Hi! I have a text box containing mText with fields. I have drawn up the multiline box I want to have the text in, problem is that when the fields change the text gets longer and therefor makes the box bigger leading to my text no longer staying within the size its supposed to. Is there a way to fit mtext? Force it to stay within the set border and if more rows than fit are added, shrink the text? Thank you!
  13. The overall goal is to reduce data entry. I have an excel file that has been special pasted into my Autodesk AutoCAD LT. I want to take information from individual cells and make them into fielded values. If you have follow-up questions, I will be happy to answer.
  14. Hi I am trying to get a field to link two texts, so that when the first is edited, the second updates to the same, similar to the =CELL function in excel. I can get this to work when using standard text, however when I try to do this with text that is bold and Arial Narrow, the second text displays lots of additional information. I have attached a screen grab of the field window to show what I mean. How can I avoid this? I am working on AutoCAD LT 2016.
  15. Is there any way to update new field attributes in existing blocks already placed in the drawing? I have tried BATTMAN, REFEDIT, ATTSYNC, FIELDEVAL=31... nothing is working. Or will I have to insert all those blocks again? Cause for now that's the only way I can make it work.
  16. I am trying to create blocks that have a fields, I would like to have it so you can just update the field without actually editing the block. Is this possible? *update* This block is basic notes that need to be shown on different jobs but might have some job specific data that needs to be updates, my thought would be to create a field (or something similar) that someone could just click and add the information they need without opening the editor. But maybe that is just what they will need to do.
  17. i've learned a few different techniques for making an affective title block but i want to weigh in on what you guys think as I have not mastered this yet. Right now i'm drawing my title block linework and permanent text in model space. then I xref that file into paper space of drawing for each layout/sheet. I use fields for the unique text on each page. I copy and paste these fields into each layout/sheet. I don't see too much of an issue here, however its a little time consuming to copy and paste these fields every time i make a new layout/sheet. Is there a simple way to insert my title block xref and insert these fields in one step? I think this is where the dwt file comes into play but i dont know. whats the difference between dwt and dwg? What if i want to shift the position of the sheet number on every page? Can we setup the title block to allow one to shift the sheet number once and apply the change to every page? Thanks for your help in advance!
  18. Hi all. I am trying to improve my efficiency with our drawing time. One way I can speed up the process is to fill out the title block on one layout and for it to appear the same on the other layouts. My problem is getting it to happen, so I hope someone can help me out. I have the title block set up with attributes, and although the Gatte command works it is not quite what I am looking for. I have set up fields, customized drawing properties, and tried to set up sheets in the manager. Either I am missing a step or going about it the wrong way. Can anyone help in pointing me in the right direction? Thank you.
  19. I run Autocad 2010 on Windows XP, eventhough I always had this problem and never could find a solution. I have a problem when I copy a text with a surface field associated to a polyline. I have a drawing in cm but I need the surfaces to be in m², hence I use a conversion factor. I created the field and associated with the polyline. If I copy the field and associate it with a new polyline, I lose the settings of the conversion factor, so that everytime I copy it I have to reset the conversion factor. Is there anyway to keep those settings? Thank you Duccio
  20. Last week I created a dynamic block that contained Text objects (with inserted Fields) that displayed each Text Object's position within the Block. In other words, my Text objects displayed their own X or Y position as relevant. I had re-opened the drawing several times that day and everything worked fine. I opened the file today and all the fields contain ######. DYNAMIC BLOCK USE: Dynamic map grid DESCRIPTION: Combines a Linear Parameter with an Array Action that arrays the grid lines and their position labels. Once the block is setup it is exploded and regenerated - the labels then display their positions within the drawing. FIELD CONTENTS: Each grid label is a field that looks at its own Text Alignment X or Y position. I set this up by copying and pasting a Field Expression into the formula entry area. As you cannot select the Text Object you are currently in, I used dummy text fields to find the Field Expression I needed for the desired Text Object. Does anyone know why my dynamic blocks work fine one day and not the next - this has happened for some of my other dynamic blocks. When you edit the fields the formulas have gone. Any help would be greatly appreciated - thanks in advance.
  21. Hi I'm new to the site so I'll try and be as clear as possible! I am creating a new title block for my office. In the new block I am using fields to limit the amount we have to fill it out. This has worked well with the exception of getting the viewport scale to work properly. I have visited just about every forum on the internet to see how to make this work and all i can discover is that I don't appear to be doing anything wrong. So my question is this. I am using a field in a title block that links to a viewport to give its custom scale value. ie the viewport is set at 1:100 then in the title block says that the scale shown in the drawing is 1:100. If I have to change the scale in the viewport to 1:50 then i can regen my layout and my title block will now say that the scale shown in the drawing is 1:50. Like Magic!! However this is not working for the scales 1:5, 1:25 & 1:200. Instead of the scale the field in the block just says "CUSTOM". Does anyone know why and how i can fix this? It makes no sense to me and works with all the other scales that we use. Thanks in advance
  22. psuengineer84

    Dynamic Block Fields

    I cannot figure out how to get a field to update to a linear parameter within a dynamic block. See attached. There is a regular dimension string on the left and my custom dynamic block on the right. Don't mind that the action parameters do not affect the field, as I will update that when I figure this thing out. Thanks! SMALL_DIM.dwg
  23. Greetings all! I recently wrote a routine that took information from the user via a dialog box and populated our titlemark block. After I got this working I wanted to add some additional functionality by having the user pick the viewport the titlemark would be associated with and by using a field populate the scale in the titlemark instead of having the user type in the input. I have attached my desired result. here is the code I am using, I think my problem area is in red. (defun C:TLMK ( / TLMK_LEN PT1) (setvar "CMDECHO" 0) (setq tempunits (getvar "insunits")) ;======================================================================================================================================== LOADS DIALOG BOX (defun TLMK(/ DCL_ID) (setq DCL_ID (load_dialog "n:/tuterj/AutoLISP/Working/TL-MK_Scale_add.DCL")) (if (not (new_dialog "TLMK" DCL_ID)) (exit)) (setq mark_n nil) (setq title_n nil) (action_tile "cancel" "(done_dialog) (exit)") (action_tile "mark_n" "(setq mark_n $value)") (action_tile "title_n" "(setq title_n $value)") (start_dialog) (unload_dialog DCL_ID) (princ) ) ;defun TLMK (TLMK) ;======================================================================================================================================== End of Dialog BOx [color=red](vl-load-com)[/color] [color=red](setq vpent (car (nentsel "\nselect viewport"))) ;user selects viewport and viewport id is stored under vpent[/color] [color=red](vlax-ename->vla-object vpent) ;vpent is transformed from an entity to a VLA object[/color] [color=red](setq scale_fld (strcat "%<\AcObjProp.16.2 Object(%<\_ObjId "(vl-princ-to-string(vla-get-Objectid vpent))">%).CustomScale \f\"%sn\">%")) ;assigns field expression to variable.[/color] (setq PT1 (getpoint "\nselect insertion point: ")) (setvar "ATTDIA" 0) (setq title_u (strcase title_n)) ;declaring additional variable to change case for title_n (setvar "insunits" 0) ;setting insertion units to unitless for proper scale of inserted block (command "insert" "N:/Tuterj/AutoLISP/Working/TitleMark-field.dwg" PT1 "" "" title_u scale_fld mark_n) ;inserting the contents of TitleMark drawing and inserting user input from dialog box. (setvar "ATTDIA" 1) (setvar "CMDECHO" 1) (setvar "insunits" tempunits) ) ;defun C:TLMK I have also attached the error I am getting when I try to run the routine. I would appriciate any help anyone is willing to provide. Thank you all for your time and for reading.
  24. stenna

    CTAB Field editing

    Evening All I have a scenario where I want to use some thing like the system variable CTAB in a field but have it report another Layout Name in the drawing rather than the Layout that I'm working in. Let me explain..... I'm producing phasing drawings for a well known supermarket and I use the Layout Tab name to drive the phasing dates within the Layout. ie P1 - Thu 23 Oct. I then use this to populate the title block etc with the system variable CTAB this saves me a whole load of time as I know the dates on the Layout tab name are correct and will therefore be right in the drawings (upwards of 25 drawings per project). I've just had a request to add some more information into the drawings but this has the date for the next phase ie P2 - Fri 24 Oct, I cant use the CTAB variable as it will report the wrong date ; Is there a way I can report another Layout Tab name with a system variable or through Diesel? Hope that makes sense! Stenna
  25. Hi guys, is there any command that performs the selection of objects associated with an object field? I'm using an excellent routine performed by Lee Mac to make the sum of texts. At the end of addition, it generates a field. In some moments I need to check the path where I spent. It would be very interesting if we could make a quick selection using the ID of the objects contained in the field. I should point out that I still have no experience with the Lisp language. Thank in advance. Luis Augusto. Currently with autocad 2010 Translated by google
×
×
  • Create New...