(entmod)ing an xref path

Discussion in 'AutoCAD' started by Cliff Davis, Mar 1, 2004.

  1. Cliff Davis

    Cliff Davis Guest

    I am using the following code to try to soft path xref's automatically but
    the "entmod" simply returns nil.

    ; returns a file name without a path
    (defun get_file_name (file_name / string_length_orig string_length)
    (setq string_length_orig (setq string_length (strlen file_name)))
    (while (not (= (substr file_name string_length 1) "\\"))
    (setq string_length (- string_length 1))
    )
    (substr file_name (+ string_length 1) string_length_orig)
    )

    (defun test ()
    (setq first_loop t)
    (while (setq current_block (tblnext "block" first_loop))
    (setq first_loop nil)
    (if (= (dxf 70 current_block) 36)
    (progn
    (setq xref_string (dxf 1 current_block))
    (if (= (substr xref_string 2 2) ":\\")
    (setq file_name (get_file_name xref_string))
    )
    ;-----------------------------------------------------------------------------------------------------------------------------------
    -----
    ;-----------------------------------------------------------------------------------------------------------------------------------
    -----
    (setq current_block (entget (tblobjname "block" (dxf 2 current_block))))
    (setq current_block (subst (cons 1 file_name) (assoc 1 current_block) current_block))
    (entmod current_block)
    ;-----------------------------------------------------------------------------------------------------------------------------------
    -----
    ;-----------------------------------------------------------------------------------------------------------------------------------
    -----
    )
    )
    )
    )


    When done manually:
    Command: !current_block
    ((-1 . <Entity name: 4050c938>) (0 . "BLOCK") (330 . <Entity name: 4050c930>)
    (5 . "2597") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockBegin")
    (70 . 36) (10 0.0 0.0 0.0) (-2 . <Entity name: 4008b950>) (2 . "6602.00 bld01 -
    XTitleB") (1 . "6602.00 bld01 - XTitleB.dwg"))

    Command: (entmod current_block)
    nil


    Any ideas on why I can't entmod the path, is there some rule I am unaware of?
    Cliff
     
    Cliff Davis, Mar 1, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.