Results 1 to 4 of 4

Thread: Check for overwritten dimensions on each layout in a drawing

  1. #1
    Member
    Join Date
    2023-07
    Posts
    4
    Login to Give a bone
    0

    Default Check for overwritten dimensions on each layout in a drawing

    Please help!
    I'm trying to convert this AutoCAD lisp routine that works perfectly fine on the current layout to one that will run on each layout.
    It works great on a single layout - but I cannot get it to run on multiple layouts.

    Single layout:
    Code:
    (defun c:DMO (/ ss en) 
      (command "_.layer" "_thaw" "0-DIMOVER" "_make" "0-DIMOVER" "c" "30" "" "")
      (prompt "To isolate dimensions with overridden measurement values,")
      (setq ss (ssget "_X" '((0 . "DIMENSION") (1 . "~")))); ignores no-override ones
      (repeat (sslength ss)
        (setq en (ssname ss 0))
        (if
          (not (wcmatch (cdr (assoc 1 (entget en))) "*<>*")); override containing actual measurement
          (command "_.chprop" en "" "la" "0-DIMOVER" "_color" "BYLAYER" "")
        ); if
        (ssdel (ssname ss 0) ss)
      ); repeat
      (princ)
     ):end program
    Here I'm trying to covert it to run on each sheet, after creating the layer. I can't get it to run past the current sheet.
    Code:
    (defun C:CLEAN (/ ss en) 
      (command "_.layer" "_thaw" "0-DIMOVER" "_make" "0-DIMOVER" "c" "30" "" "")
    
      (foreach layout (layoutlist)
        (setvar "ctab" layout)
    
      (prompt "To isolate dimensions with overridden measurement values,")
      (setq ss (ssget "_X" '((0 . "DIMENSION") (1 . "~")))); ignores no-override ones
      (repeat (sslength ss)
        (setq en (ssname ss 0))
        (if
          (not (wcmatch (cdr (assoc 1 (entget en))) "*<>*")); override containing actual measurement
          (command "_.chprop" en "" "_layer" "0-DIMOVER" "_color" "BYLAYER" "")
        ); if
        (ssdel (ssname ss 0) ss)
      ); repeat
      (princ)
      ^^C
    
      ); end foreach
    ); end defun
    Last edited by Ed Jobe; 2023-08-04 at 06:10 PM. Reason: Added CODE tags

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,094
    Login to Give a bone
    0

    Default Re: Check for overwritten dimensions on each layout in a drawing

    The ssget function was getting all of the dimensions...

    It was the chprop function that was causing the problem.

    I converted the dimension entity to an object and used activex to change its properties... see below

    P=

    Code:
    (defun c:DMO (/ ss en obj) 
     (command "_.layer" "_thaw" "0-DIMOVER" "_make" "0-DIMOVER" "c" "30" "" "")
     (prompt "To isolate dimensions with overridden measurement values,")
     (setq ss (ssget "_X" '((0 . "DIMENSION") (1 . "~")))); ignores no-override ones
     (repeat (sslength ss)
      (setq en (ssname ss 0))
      (if (not (wcmatch (cdr (assoc 1 (entget en))) "*<>*")); override containing actual measurement
       (progn
        (setq obj (vlax-ename->vla-object en))
        (vla-put-layer obj "0-DIMOVER")
        (vla-put-color obj 256)
       )
      ); if
       (ssdel (ssname ss 0) ss)
     ); repeat
     (princ)
    ):end program
    
    (vl-load-com)
    Attached Files Attached Files
    AutomateCAD

  3. #3
    Member
    Join Date
    2023-07
    Posts
    4
    Login to Give a bone
    0

    Default Re: Check for overwritten dimensions on each layout in a drawing

    Thank you Peter!

    It's much closer as it will run through each layout, but it doesn't change the layer of the overwritten dimensions.

    I'm not sure why.

    Dorothy

    - - - Updated - - -

    (defun C:CLEAN (/ ss en)
    (command "_.layer" "_thaw" "0-DIMOVER" "_make" "0-DIMOVER" "c" "30" "" "")
    (prompt "To isolate dimensions with overridden measurement values,")
    (setq ss (ssget "_X" '((0 . "DIMENSION") (1 . "~")))); ignores no-override ones
    (repeat (sslength ss)
    (setq en (ssname ss 0))
    (if (not (wcmatch (cdr (assoc 1 (entget en))) "*<>*")); override containing actual measurement
    (progn
    (setq obj (vlax-ename->vla-object en))
    (vla-put-layer obj "0-DIMOVER")
    (vla-put-color obj 256)
    )
    ); if
    (ssdel (ssname ss 0) ss)
    ); repeat
    (princ)
    ):end program

    (vl-load-com)

  4. #4
    Member
    Join Date
    2023-07
    Posts
    4
    Login to Give a bone
    0

    Default Re: Check for overwritten dimensions on each layout in a drawing

    Disregard last post Peter,

    It works perfect!!!!

    Thank you!!!!!!

Similar Threads

  1. Find overwritten dimensions in AutoCAD
    By pkorneszczuk777867 in forum AutoLISP
    Replies: 6
    Last Post: 2019-02-07, 12:59 PM
  2. For each...next within for each...next
    By CADfunk MC in forum VBA/COM Interop
    Replies: 2
    Last Post: 2009-05-15, 05:01 PM
  3. Replies: 3
    Last Post: 2007-01-15, 06:12 PM
  4. New files got overwritten
    By tdinh in forum ACA General
    Replies: 5
    Last Post: 2006-03-17, 12:21 PM
  5. Replies: 4
    Last Post: 2004-10-29, 07:03 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •