bloki anonimowe - jak stworzyć?


Recommended Posts

W LISP za przykład może posłużyć :

(setq defnition(entmake (list (cons 0 "BLOCK") (cons 100 "AcDbEntity")(cons 100 "AcDbBlockBegin")(cons 67 0)(cons 8 "0")(cons 70 0)(cons 10 (list 0.0 0.0 0.0))(cons 2 "*Z")(cons 1 ""))))

(setq LiniaDef(entmake (list '(0 . "LINE") '(100 . "AcDbEntity") '(100 . "AcDbLine")(cons 10 (list 0 0 0))(cons 11 (list 100 120 0)))))
(setq BezNazwa(entmake '((0 . "ENDBLK"))))

(setq Insertion(entmake(setq naglowek (list '(0 . "INSERT") '(100 . "AcDbEntity")'(100 . "AcDbBlockReference") (cons 2  BezNazwa) (cons 10 (getpoint)) (cons 50 0) '(66 . 1) ) )))

(entmake (quote((0 ."SEQEND"))))

Link to comment
Share on other sites

Działa łądnie ale tylko w Au.. (programie konkurencyjnym). W ZWCadzie wyskakuje błąd:

error: *Error*

(VLA-ADD (VLA-GET-BLOCKS DOC) (VLAX-3D-POINT POINT) NAME)

(SETQ NAME# (VLA-ADD (VLA-GET-BLOCKS DOC) (VLAX-3D-POINT POINT) NAME))

((LAMBDA ( ) (VLA-COPYOBJECTS DOC )) (SETQ NAME# (VLA-ADD (VLA-GET-BLOCKS DOC) (VLAX-3D-POINT POINT) NAME)) (VLAX-SAFEARRAY-FILL (VLAX-MAKE-SAFEARRAY VLAX-VBOBJECT (CONS 0 (1- (LENGTH SS#)))) SS#))

(KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC))

(SETQ BN# (KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC)))

(PROGN (SETQ ZD (TRANS (QUOTE (0 0 1)) 1 0 T)) (SETQ BN# (KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC))) (FOREACH S# (VLA-DELETE )) (KR:BLK_INSERTBLOCKVLA (TRANS BP 1 0) (SETQ BN (KR:BLK_GETBLOCKNAME BN#)) 1 1 1 0) (PRINC (STRCAT "\n>> Anonymous block " BN " created. <<")))

(IF (SETQ SS (SSGET)) (PROGN (SETQ ZD (TRANS (QUOTE (0 0 1)) 1 0 T)) (SETQ BN# (KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC))) (FOREACH S# (VLA-DELETE )) (KR:BLK_INSERTBLOCKVLA (TRANS BP 1 0) (SETQ BN (KR:BLK_GETBLOCKNAME BN#)) 1 1 1 0) (PRINC (STRCAT "\n>> Anonymous block " BN " created. <<"))) (PRINC "\n** Nothing selected **"))

(PROGN (PRINC "\nSelect object to convert to block: ") (IF (SETQ SS (SSGET)) (PROGN (SETQ ZD (TRANS (QUOTE (0 0 1)) 1 0 T)) (SETQ BN# (KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC))) (FOREACH S# (VLA-DELETE )) (KR:BLK_INSERTBLOCKVLA (TRANS BP 1 0) (SETQ BN (KR:BLK_GETBLOCKNAME BN#)) 1 1 1 0) (PRINC (STRCAT "\n>> Anonymous block " BN " created. <<"))) (PRINC "\n** Nothing selected **")))

(IF (SETQ BP (GETPOINT "\nSelect insertion point for block: ")) (PROGN (PRINC "\nSelect object to convert to block: ") (IF (SETQ SS (SSGET)) (PROGN (SETQ ZD (TRANS (QUOTE (0 0 1)) 1 0 T)) (SETQ BN# (KR:BLK_MAKEBLOCKVLA (TRANS BP 1 0) "*U" (SETQ SS# (KR:SSX_SS->VLA SS)) (KR:ACX_ADOC))) (FOREACH S# (VLA-DELETE )) (KR:BLK_INSERTBLOCKVLA (TRANS BP 1 0) (SETQ BN (KR:BLK_GETBLOCKNAME BN#)) 1 1 1 0) (PRINC (STRCAT "\n>> Anonymous block " BN " created. <<"))) (PRINC "\n** Nothing selected **"))) (PRINC "\n** Invalid point **"))

(C:MAB)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share