Jump to content

Search the Community

Showing results for tags 'layer rename'.

  • 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 1 result

  1. *Disclaimer* I'm not sure where this code came from, it's probably hashed together from several forum posts. I'm working on revising this layer renamer that didn't quite work. I've got the dialog box setup and working fine. I've got the layer renaming functions setup and working fine. The problem is when I try to execute the layer renaming function from the dialog box it crashes. I think it's getting stuck in a loop because the VLIDE gets stuck until I close the AutoCAD drawing and open a new one. I've simplified the code down for brevity. If any can take a look at it and give some suggestions I'd be very grateful. Thanks in advance! ;|------BEGIN---LAYER RENAMER DIALOG BOX---------------------------------------------------------------|; (defun C:layerRenamer (/ dcl_id fn fname) (vl-load-com) (create_dialog) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "layerRenamer" dcl_id)) (exit) ) ;if (action_tile ;This action tile causes a crash when using the UnitLayer function. It works fine when using the testFunction. "btnUnit" "(c:unitLayer)" ) (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (princ) ) (defun create_dialog () (setq fname (vl-filename-mktemp "dcl.dcl")) (setq fn (open fname "w")) (write-line "layerRenamer : dialog { label = \"Automated Layer Renaming - V06-08-15\"; : column { : boxed_column { : button { key = \"btnUnit\"; label = \"Fix Standard Unit Layers\"; is_default = false; } } : boxed_row { : button { key = \"cancel\"; label = \"Close\"; is_default = true; is_cancel = true; } } } }" fn ) (close fn) ) ;|------END-----LAYER RENAMER DIALOG BOX---------------------------------------------------------------|; ;|------BEGIN---BASIC RENAMING FUNCTION----------------------------------------------------------------|; (defun c:renameLayer ( oldLayer newLayer / ss i ent ) (cond ((and (tblsearch "layer" oldLayer) (not (tblsearch "layer" newLayer))) (command "._rename" "la" oldLayer newLayer) ) ((and (tblsearch "layer" oldLayer)(tblsearch "layer" newLayer)) (setq ss (ssget "x" (list (cons 8 oldLayer)))) (setq i -1) (repeat (sslength ss) (setq ent (entget (ssname ss (setq i (1+ i)))) ent (subst (cons 8 newLayer) (cons 8 (cdr (assoc 8 ent))) ent) ) (entmod ent) ) ) ((not (tblsearch "layer" oldLayer)) (prompt (strcat "\nLayer " oldLayer " not found. ")) ) ) (princ) ) ;|------END-----BASIC RENAMING FUNCTION----------------------------------------------------------------|; ;|------BEGIN---DRAWING SPECIFIC RENAMING FUNCTIONS----------------------------------------------------|; (defun c:unitLayer ( / newLayer ) ;This function runs perfectly when run from the command line but crashes when run from dialog box. (setq newLayer "1_ANSI") (foreach oldLayer '("ANSI" "_ANSI" "F.H." "1_F.H.") (renameLayer oldLayer newLayer)) (command "._purge" "la" "" "n") ) ;|------END-----DRAWING SPECIFIC RENAMING FUNCTIONS----------------------------------------------------|; (defun c:testFunction () (print "Test Function Ran") (princ) )
×
×
  • Create New...