Jump to content

Search the Community

Showing results for tags 'field'.



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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 22 results

  1. Hello, I have a lengthy lisp routine that hasn't been updated in years. It is strictly for Custom Field Insertions and I do not remember how to edit it. I created a diesel expression for what I'm trying to do which is simply adding dashes to a filename and removing the last 4 characters for our DWG #'s in the CAD file. I've made a diesel expression included below but it is too long for using MacAttEdit so I'd like to add it to this lisp routine if someone can understand it. Or perhaps if someone knows how to make the Diesel Expression shorter as I am just a novice at this. Our current file name is (28 characters): AB12345AB1234ABCA123456789-1 The DWG # is (FIRST 24 characters plus 5 dashes, so 29 characters): AB-12345-AB1234-ABC-A12-12345 Diesel Expression (long I know): %<\AcDiesel $(substr,$(getvar,DWGNAME),1,2)-$(substr,$(getvar,DWGNAME),3,5)-$(substr,$(getvar,DWGNAME),8,6)-$(substr,$(getvar,DWGNAME),14,3)-$(substr,$(getvar,DWGNAME),17,3)-$(substr,$(getvar,DWGNAME),20,5)>% Lisp with custom insertions: (defun c:updatetitleblock ( / ;;local variables acadObject acadDocument dProps customPropertyName customPropertyNamecpchem revCustomPropertyName projectCustomPropertyName folderCustomPropertyName folderCustomPropertyName2 KeyCount KeyValue strDrawingName strRevNum strDrawingNameNoSpaces left20characters left21characters left22characters left23characters left24characters left25characters left26characters left27characters left28characters left2characters left18characters ) ;;sets the document properties (setq acadObject (vlax-get-acad-object) acadDocument (vla-get-ActiveDocument acadObject) dProps (vlax-get-Property acadDocument 'SummaryInfo) customPropertyName "DRAWING No. (from file name)" customPropertyNamecpchem "filename sans characters after penultimate dash" revCustomPropertyName "REV (from file name)" projectCustomPropertyName "PROJECT NO (from file name)" projectCustomPropertyName2 "file name before underscore" folderCustomPropertyName "last character of folder" folderCustomPropertyName2 "last 2 characters of folder" left20characters "filename (left 20 characters)" left21characters "filename (left 21 characters)" left22characters "filename (left 22 characters)" left23characters "filename (left 23 characters)" left24characters "filename (left 24 characters)" left25characters "filename (left 25 characters)" left26characters "filename (left 26 characters)" left27characters "filename (left 27 characters)" left28characters "filename (left 28 characters)" left2characters "filename (left 2 characters)" left18characters "filename (left 18 characters)" ) ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName customPropertyName) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps customPropertyName "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left20characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left20characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left20characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left21characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left21characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left21characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left22characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left22characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left22characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left23characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left23characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left23characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left24characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left24characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left24characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left25characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left25characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left25characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left26characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left26characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left26characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left27characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left27characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left27characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left28characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left28characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left28characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left2characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left2characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left2characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR left18characters;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName left18characters) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps left18characters "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR CPchem;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName customPropertyNamecpchem) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps customPropertyNamecpchem "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR REV;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName revCustomPropertyName) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps revCustomPropertyName "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR folderLastDigit;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName folderCustomPropertyName) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps folderCustomPropertyName "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR project number;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName projectCustomPropertyName) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps projectCustomPropertyName "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR project number;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName projectCustomPropertyName2) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps projectCustomPropertyName2 "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;SAME THING AS ABOVE, BUT FOR project number;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets a couple variables so that we can determine whether the property exists (setq KeyCount 0 KeyValue nil) ;;while KeyValue is blank and KeyCount is less than number of properties (while (and (null KeyValue) (< KeyCount (vla-NumCustomInfo dProps))) ;;get info about that property (vla-GetCustomByIndex dProps KeyCount 'TempKeyName 'TempKeyValue ) ;;if the property name matches the name we want, set KeyValue to it's value (if (= TempKeyName folderCustomPropertyName2) (setq KeyValue TempKeyValue) ) ;;increment KayCount (setq KeyCount (1+ KeyCount)) ) ;; ;;now we add the property if it wasn't there already (if (= KeyValue nil) (vla-addcustominfo dProps folderCustomPropertyName2 "REOPEN DRAWING TO UPDATE") ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;sets strDrawingName as the name of the current drawing (setq strDrawingName (getvar "dwgname")) ;;resets strRevNum (setq strRevNum "") ;;makes strDrawingName uppercase (setq strDrawingName (strcase strDrawingName)) ;;if the drawing name ends in .DWG, take off the last 4 characters (if (= (substr strDrawingName (- (strlen strDrawingName) 3) (strlen strDrawingName)) ".DWG") (setq strDrawingName (substr strDrawingName 1 (- (strlen strDrawingName) 4))) (setq strDrawingName strDrawingName) ) ;;makes strDrawingNameNoSpaces (setq strDrawingNameNoSpaces strDrawingName) (while (/= strDrawingNameNoSpaces (vl-string-subst "" " " strDrawingNameNoSpaces)) (setq strDrawingNameNoSpaces (vl-string-subst "" " " strDrawingNameNoSpaces))) ;;makes all the set-length filenames (setq strleft20characters (substr strDrawingNameNoSpaces 1 20)) (setq strleft21characters (substr strDrawingNameNoSpaces 1 21)) (setq strleft22characters (substr strDrawingNameNoSpaces 1 22)) (setq strleft23characters (substr strDrawingNameNoSpaces 1 23)) (setq strleft24characters (substr strDrawingNameNoSpaces 1 24)) (setq strleft25characters (substr strDrawingNameNoSpaces 1 25)) (setq strleft26characters (substr strDrawingNameNoSpaces 1 26)) (setq strleft27characters (substr strDrawingNameNoSpaces 1 27)) (setq strleft28characters (substr strDrawingNameNoSpaces 1 28)) (setq strleft2characters (substr strDrawingNameNoSpaces 1 2)) (setq strleft18characters (substr strDrawingNameNoSpaces 1 18)) ;;makes strDrawingNamecpchem (setq strDrawingNamecpchem strDrawingNameNoSpaces) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 1) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 2))) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 2) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 3))) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 3) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 4)))) ) ) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 1) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 2))) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 2) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 3))) (if (= (substr strDrawingNamecpchem (- (strlen strDrawingNamecpchem) 3) 1) "-") (setq strDrawingNamecpchem (substr strDrawingNamecpchem 1 (- (strlen strDrawingNamecpchem) 4)))) ) ) ;;does stuff to get rid of revision number (if (= nil (vl-string-search "REV" strDrawingName)) ;;unless there is no rev, in which get rid of trailing numbers ;;if the last three digits of DrawingNameNoSpaces has a dash or a period or an underscore (if (/= (substr strDrawingNameNoSpaces (- (strlen strDrawingNameNoSpaces) 2) 3) (vl-string-subst "" "." (vl-string-subst "" "_" (vl-string-subst "" "-" (substr strDrawingNameNoSpaces (- (strlen strDrawingNameNoSpaces) 2) 3))))) (while (/= "_" (substr strDrawingName (strlen strDrawingName) 1) "-" (substr strDrawingName (strlen strDrawingName) 1) ".") (setq strRevNum (strcat (substr strDrawingName (strlen strDrawingName) 1) strRevNum) strDrawingName (substr strDrawingName 1 (- (strlen strDrawingName) 1)) ) ) ;;otherwise, if the last four digits are a dash and 3 numbers (if (= (vl-string-right-trim "0123456789" (substr strDrawingNameNoSpaces (- (strlen strDrawingNameNoSpaces) 3) 4)) "-") (progn (setq strRevNum (substr strDrawingNameNoSpaces (- (strlen strDrawingNameNoSpaces) 2) 3) strDrawingName (substr strDrawingName 1 (- (strlen strDrawingName) 4)) ) ) ) ) ;;gets rid of everything past the REV (setq strRevNum (substr strDrawingName (+ 4 (vl-string-search "REV" strDrawingName)) (- (+ 1 (strlen strDrawingName)) (vl-string-search "REV" strDrawingName))) strDrawingName (substr strDrawingName 1 (vl-string-search "REV" strDrawingName))) ) ;;gets rid of trailing spaces and dashes (setq strDrawingName (vl-string-right-trim " -._(" strDrawingName)) (setq strRevNum (vl-string-right-trim " -._()" strRevNum)) ;;gets rid of #. or ##.from beginning of drawing name (if (or (= (substr strDrawingName 2 1) ".") (= (substr strDrawingName 3 1) ".")) ;;gets rid of opening digits (setq strDrawingName (vl-string-left-trim "0123456789" strDrawingName)) ;;otherwise do nothing (setq strDrawingName strDrawingName) ) ;;gets rid of leading spaces and dashes (setq strDrawingName (vl-string-left-trim " -._)" strDrawingName)) (setq strRevNum (vl-string-left-trim " -._()" strRevNum)) ;;gets rid of leading zeros from drawing rev (if (and (= (substr strRevNum 1 1) "0") (> (strlen strRevNum) 1)) (setq strRevNum (substr strRevNum 2 (- (strlen strRevNum) 1))) ) (if (and (= (substr strRevNum 1 1) "0") (> (strlen strRevNum) 1)) (setq strRevNum (substr strRevNum 2 (- (strlen strRevNum) 1))) ) (if (and (= (substr strRevNum 1 1) "0") (> (strlen strRevNum) 1)) (setq strRevNum (substr strRevNum 2 (- (strlen strRevNum) 1))) ) ;;sets the property to our formatted name (vla-SetCustomByKey dProps left20characters strleft20characters) (vla-SetCustomByKey dProps left21characters strleft21characters) (vla-SetCustomByKey dProps left22characters strleft22characters) (vla-SetCustomByKey dProps left23characters strleft23characters) (vla-SetCustomByKey dProps left24characters strleft24characters) (vla-SetCustomByKey dProps left25characters strleft25characters) (vla-SetCustomByKey dProps left26characters strleft26characters) (vla-SetCustomByKey dProps left27characters strleft27characters) (vla-SetCustomByKey dProps left28characters strleft28characters) (vla-SetCustomByKey dProps left2characters strleft2characters) (vla-SetCustomByKey dProps left18characters strleft18characters) (vla-SetCustomByKey dProps customPropertyNamecpchem strDrawingNamecpchem) (vla-SetCustomByKey dProps customPropertyName strDrawingName) (vla-SetCustomByKey dProps revCustomPropertyName strRevNum) (vla-SetCustomByKey dProps folderCustomPropertyName (substr(getvar "dwgprefix") (- (strlen (getvar "dwgprefix")) 1) 1)) (vla-SetCustomByKey dProps folderCustomPropertyName2 (substr(getvar "dwgprefix") (- (strlen (getvar "dwgprefix")) 2) 2)) (vla-SetCustomByKey dProps projectCustomPropertyName (vl-string-right-trim " -._()" (substr strDrawingName 1 10))) (vla-SetCustomByKey dProps projectCustomPropertyName2 (vl-string-right-trim " -._()" (substr strDrawingName 1 (vl-string-search "_" strDrawingName)))) ;;forces update (command "updatefield" "all" "") ) (vl-load-com) (c:updatetitleblock) (princ) Thanks for any assistance and if I figure it out somehow I will re-post here.
  2. hi i"m trying to create a dynamic plan-staircase with step numbers, the stairs are added by an array command and i could count the total number of stairs by dividing the total distance by width of step. stair2.dwg but i want a number on each step ! (using autocad 2014)
  3. Hopefully I am just unaware of a setting or method for doing this but so far the field command is handy but missing something. Associative updates. When a polyline is drawn and used for calculating the area the field command does a quick job of extracting that info into a field text element. Problem is when that polyline boundary is changed the "field text" that was established previously does not update. Is this even possible or am I S.O.L.?
  4. (defun c:test(/ tab ent Obj pt tObj row col) (vl-load-com) (if (and (setq tab (car (entsel "\nSelect Table: "))) (eq "ACAD_TABLE" (cdr (assoc 0 (entget tab))))) (while (and (setq ent (car (entsel "\nSelect Object: "))) (vlax-property-available-p (setq Obj (vlax-ename->vla-object ent)) 'Area)) (while (progn (setq pt (getpoint "\nClick into Cell to place field: ")) (cond ((vl-consp pt) (if (eq :vlax-true (vla-hittest (setq tObj (vlax-ename->vla-object tab)) (vlax-3D-point pt) (vlax-3D-point (trans '(0 0 1) 0 1)) 'row 'col)) nil (princ "\n** No Cell Selected **"))) (t (princ "\n** No Point Selected **"))))) (vla-setText tObj row col (strcat "% (vl-princ-to-string (vla-get-Objectid Obj)) ">%).Area \\f \"%lu2%pr2%ps[, Sq m]\">%"))) (princ "\n** No Table Selected **")) (princ))
  5. Hello everyone. This is my first time posting but i have enjoyed a lot of your great work. I use a lot a field about object/polyline/length - decimal 0 (copy it to different polylines and than get their lenghth) and i am tired of changing object from dialogbox. Is there an easy way (lisp or other) to change the object directly and get its length:):)
  6. Hi everyone, I have a quite a specific question relating to auto-filling fields that are inserted into text. To give you some context I work in the lighting design industry and draw 2D lighting layout plans. I am currently trying to build a collection of dynamic blocks which contain attributes relating to their reference letter, circuit number, location, etc etc. This bit I have done quite easily. I plan to use these attributes to export to excel later, again something I already have working. The way our company labels the light fittings on plan is to use a leader. However if I have already given the block the information it requires for it attributes (and excel usefulness) I don't want to spend time typing it all out again in the leader. I have inserted some fields into my leader that recall the information I have stored in the block attributes but it is probably slower to insert them and click through the Field dialogue box than it is to just type in manually! What I want is to be able to have a generic leader with the fields that will refer to any given block (using the same names for those attributes) that when, for example the tip of the leader arrow touches a specific block the fields know that is the object they need information from, that way I don't have to right click each field and re-select the block manually. I just need a way of making this a one action process for each leader instead of having to do it for each field within it. I hope this makes sense to someone, more than happy to try and explain better if not! Many thanks, Matt
  7. Hello, I am trying to figure out a way to get all of my common data (detail numbers, sheet numbers, and when I bubble an item from my BOM) to update easier. The best way I found to do this seems to be using Field. Field works with regular text really well, but I cant figure out how to get the correct data from Mtext or from a table. Meaning, Field pulls all data from Mtext, and only table data from tables (i.e, nothing inserted inside the table, just table height and whatnot). I would like to use a table so that I can copy paste my BOM from excel, and Field reference to the data in that table. If you have an easier solution I would appreciate that too.. Using full Autocad 2017, Mechanical. Also, I tried using Custom Drawing Properties but that maxes out at 10, and I cannot populate it easily from the excel file. I know I can use sheetset for the sheet numbers, but see no way to use it for the BOM.
  8. Hello, I don't even know where to begin... I'm trying to construct a scale bar that can be linked with a chosen viewport, upon insertion into paperspace. Civil3d 2015 already has several of these "preloaded" in the Layout Element panel, but these scalebars are not "smart", requiring input from the user (I'm trying to create these for newbies in our office). Any thoughts or help is appreciated.
  9. Hi I am new to using fields, and I am having an issue. I wish to link two mtexts, so when the first is edited, the second updates to display the same text, similar to the =CELL function in excel. I use Field>Object>no format, yet it displays to complete contents, including font etc. How can I get the second text to simply display what is in the first text. I have attached a screenshot of my issue. Any suggestions gratefully received. Thanks
  10. Hi to all, Please someone knows if its possible to create a field on a text form that could count a number of texts inside a drawing?... Eg.: I have the word "L1" 10 times in a drawing, it's possible to create a field that show me how many L1 I have in this drawing? Count of L1 = [10]; the item 10 it's automatic updates.
  11. Does anyone know of a field expression or lisp routine that will allow me to display a count of the number of polylines on any specified layer? I would like the number displayed to be able to update as I add polylines to the layer, just as an area field expression would update on regen. Thanks very much
  12. I am creating a Block with attribute "X" in which X is a field calling the attribute in my section mark block. Is there any mean to show where X is referencing? I know there is a routine Showfieldlink.lsp which draws to the parent object. But the routine does not work with attribute.
  13. I'm using autocad2014 for mac. I've just started to use project manager for managing drawing for the project. I have some questions. 1. is there any way to generate the drawing list automatically from project manger ? like from all the layout's name ? (I use a title block with field(layout name) for each layout. Would like to know if there's anyway to automatically collect these information from the project manager and insert as a drawing list) 2. is there anyway to run the layout number automatically? ex. if you add layout / the number of the layout will also updated / and the layout number field in title block will also updated
  14. Hi, I have a lot of lines and I need the Total length, I have them in a separate layer, I have tried with Field and Dataextraction but it is not exactly what I need, or I did not do it exactly. For Field, I can not select all line. Dataextraction takes all lines in the drawing, I need lines that are in the layer. How can I do that? Thank you
  15. I am a little new to assigning attributes. My company had a block with two attibutes that I need to alter. When the block is inserted, it asks a quantity. The other attribute is titled location. I am told if needed, all these quantities can be totaled per drawing. It has a title of "location". Two things: Can someone explain how to replicate this action? And is there a way to show all properties of a field for an attribute? Thanks, Nobull
  16. Hey All, If you are familiar with the "Fields" associated with text attributes, you may be able to answer my question.. If you set up a date to fill-in automatically when you open a drawing, will it update from day to day? Or once its set up, will it remain on that date..? Please let me know if i am unclear..
  17. Hi guys, I have a requirement to create a block with a few attributes, but the attributes require a bit of composition behind the scenes. Here's an abstract example. I need a block that represents a computer's identity. Each computer has 2 references that need to result in attributes that I can extract. One attribute is a unique reference across the project, and the other attribute is a room reference, and many computers can be in the same room. Here are some example references. Computer A Unique Reference: DF.SALES.01 Room Reference: DG.SALES.07 Computer B Unique Reference: DF.SALES.02 Room Reference: DG.SALES.07 Computer C Unique Reference: DF.SALES.03 Room Reference: DG.SALES.07 Computer D Unique Reference: DF.ADMINISTRATION.01 Room Reference: DG.ADMINISTRATION.02 Computer E Unique Reference: DF.ADMINISTRATION.02 Room Reference: DG.ADMINISTRATION.02 As you can see from the above, the 'common' part for a computer is the middle 'SALES' or 'ADMINISTRATION' part, which 'technically' only needs to be put in/typed in by the user once for each computer. I need to automate this process to reduce user input error, such that they only enter 'SALES' or 'ADMINISTRATION' once and don't end up creating the below, which would be invalid. Computer F Unique Reference: DF.RECEPTION.09 Room Reference: DG.SALES.07 Thus I imagine I need a third property/field/attribute to specify 'room', and then formulate the Unique Reference and Room References, using this 'room' part in the middle. The end goal here is that I need to be able to extract the above two references for each 'computer/block' and get them into Excel, and I need to be able to modify the 3 properties (room, unique reference and room reference) quickly, ideally using something like EATTEDIT, which is how we have edited attributes in the past. Apologies that this may seem like an odd request! The use case above is abstracted, it's actually not for computers at all but I figured it would make more sense than complicating it with the actual application! Many thanks in advance for any thoughts.
  18. Hi All: I'm looking for a lisp that will help accomplish the most mundane part of drafting - creating a coordinates table. I've found lisps on the internet that can do this, and actually work very well, here's an example: http://www.cadlispandtips.com/2011/09/lisp-coordinates-with-table.html This actually works great and the output is almost exactly what I want, the only problem is that the table is simply made up of lines / text. Rather than an actual Table with Fields. And while I can re-create the table over and over again, other users of the drawing (that don't have that lisp) will have to manually edit the text. So I'm looking for a lisp that will allow a user to: 1) create points / preferably with a point number 2) automatically outputs the coordinates / points number to a table in the layout view, with the correct text size, depending on scale 3) instead of putting text in the table, will put fields that are linked to each point so that if the points are moved, a simple regen of the table will update the coordinates. This can be done manually by Insert field -> Objects -> Object -> [select point] ->position -> Filter X / Y / X. Sorry if this has been asked before, I'm new to the site and haven't been able to find it yet. Really appreciate any help anyone can provide. JK
  19. I am attempting to do a preview print test of my AutoCAD drawing which I have made: SOLA4012 Pluto205.dwg 1. I cannot seems to print it in colour. Can someone tell me what I am missing? 2. My printing into PDF seems to be restricted by the dashed lines. How can I remove or expand this area? 3.The texts are also very crunched up and not as clear as AutoCAD. I am using the: DWG to PDF.PC3 setting > Paper Size ISO A4. How can I fix these output issuses? Many thanks!
  20. I've currently taken on the task of updating my organization's title blocks. I'm utilizing Fields in the title block in conjunction with system and sheet set manager variables. I've noticed in the Field Dialog Box there is a CreateDate field choice to display the date the file was created. My question is, is there - or is it possible to create - a system variable that is capable of retrieving the Windows login name of the user who created the file? There are multiple workstations at my organization and former users capable of creating AutoCAD files. I would like to be able to retrieve their Windows login name (eg. jwhitens) of the user who created the file to display as the "Drawn By" field in my title block. Any help would be greatly appreciated. Thanks!
  21. Hi everyone, I would like to read a table that would be linked with block attributes. Like a table (either AutoCAD or Excel) of fluids with pressure, temperature, flowrate... that I would link to attributes. I tried to insert a field in the attribute, but what I've found in fields are properties like Color/Layer/Column/Rows ... Anyone could help? Guiboard
  22. Hello all Long time lurker and have always been able to find answers to my questions except this one. I am using a label note to label several (100+) features across a large project. The label is going to read "Crossing Number 100" and each will read the same with the # increasing..."Crossing Number 101" which will be equated to a table. Is there a way to use the Label Note feature and have a field or compenent so that every time I insert this label it automatically inputs the next sequential number? This will save time instead of going through and editing the text of every label across the whole drawing. Thanks for all the help!
×