Mike Evans
Usenet Archive
- Joined
- Aug 17, 2000
- Messages
- 18
- Reaction score
- 0
I'm attempting to duplicate a block definition and give it a new name. The code at the bottom of this message is my attempt at this. I pass the "create-dup-def" function the name of an existing block and the new name to use, and it should create a duplicate definition of the existing block with the new name.
It appears to do this, but when I check the entity data of the new block definition, the "1" group code (xref path name) which should be "", instead has the name of the new block (in other words, group "1" and group "2" have the same values). Any ideas why this is happening? It seems defining an xref path for a non-xref block would cause problems.
Which brings me to my next problem: if I attempt to make a duplicate of the new block definition, I get "Exception occurred: 0xC0000005 (Access Violation)" errors. Is this due to the incorrect group "1" value? What else could be causing this?
Basically, I need to know what really obvious thing I'm overlooking (and all the not-so-obvious things).
Thanks for any help you can provide.
;;; *** CREATE DUPLICATE BLOCK DEFINITION FUNCTION ***
(DEFUN create-dup-def (exist-block-name new-block-name / exist-block-def object-entity-name new-block-def ) ;; ;; GET EXISTING BLOCK DEFINITION (SETQ exist-block-def (ENTGET (SETQ object-entity-name (TBLOBJNAME "BLOCK" exist-block-name)) ) ;_ ENTGET ) ;_ SETQ ;; ;; START BLOCK DEFINITION (SETQ new-block-def ;; REPLACE EXISTING BLOCK NAME WITH NEW BLOCK NAME (SUBST (CONS 2 new-block-name) (ASSOC 2 exist-block-def) exist-block-def ) ;_ SUBST ) ;_ SETQ (ENTMAKE new-block-def) ;; ;; COPY BLOCK ELEMENTS (WHILE (SETQ object-entity-name (ENTNEXT object-entity-name)) (ENTMAKE (ENTGET object-entity-name)) ) ;_ WHILE ;; ;; COMPLETE BLOCK DEFINITION (ENTMAKE (LIST (CONS 0 "ENDBLK"))) ;; ) ;_ DEFUN
It appears to do this, but when I check the entity data of the new block definition, the "1" group code (xref path name) which should be "", instead has the name of the new block (in other words, group "1" and group "2" have the same values). Any ideas why this is happening? It seems defining an xref path for a non-xref block would cause problems.
Which brings me to my next problem: if I attempt to make a duplicate of the new block definition, I get "Exception occurred: 0xC0000005 (Access Violation)" errors. Is this due to the incorrect group "1" value? What else could be causing this?
Basically, I need to know what really obvious thing I'm overlooking (and all the not-so-obvious things).
Thanks for any help you can provide.
;;; *** CREATE DUPLICATE BLOCK DEFINITION FUNCTION ***
(DEFUN create-dup-def (exist-block-name new-block-name / exist-block-def object-entity-name new-block-def ) ;; ;; GET EXISTING BLOCK DEFINITION (SETQ exist-block-def (ENTGET (SETQ object-entity-name (TBLOBJNAME "BLOCK" exist-block-name)) ) ;_ ENTGET ) ;_ SETQ ;; ;; START BLOCK DEFINITION (SETQ new-block-def ;; REPLACE EXISTING BLOCK NAME WITH NEW BLOCK NAME (SUBST (CONS 2 new-block-name) (ASSOC 2 exist-block-def) exist-block-def ) ;_ SUBST ) ;_ SETQ (ENTMAKE new-block-def) ;; ;; COPY BLOCK ELEMENTS (WHILE (SETQ object-entity-name (ENTNEXT object-entity-name)) (ENTMAKE (ENTGET object-entity-name)) ) ;_ WHILE ;; ;; COMPLETE BLOCK DEFINITION (ENTMAKE (LIST (CONS 0 "ENDBLK"))) ;; ) ;_ DEFUN