Jump to content

Recommended Posts

Posted

Eldon

 

Initially it did as expected but something has caused it to default to 'delete' (I believe). A while back I had noticed this in the dialogue box [defaulting to delete. N.B. convert to block is the default now in the dialogue box], this why I need to trap this option.

  • Replies 54
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    23

  • Johntosh

    8

  • David Bethel

    5

  • ectech

    5

Top Posters In This Topic

Posted Images

Posted

I understand what you are getting at John, but as Eldon says - I think the "convert to block" option is only with the dialog box. :(

Posted

ok guys, I concede ( but I can't help think...let it go, John)

 

I'll insert my block accordingly, now is there a way to surpress the attribute prompts? These will differ per block.

Posted

Dear Lee Mac,

 

How to convert all entities to block and give the block have name automatically, because I have many entities inside one drawing. I'm running your lisp, but it need give the insert point and filename.

 

Thanks !

Edmond

 

There is indeed:

 

I worked on this with David Bethel:

 

(defun c:obj2blk1 (/ ss bn pt i ent elist)

 ; Get Entities

   (while (not ss)
   (princ "\nSelect Objects to Convert to Blocks:")
   (setq ss (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>"))))
   ) ;_  end while

 ; Get Block Name and Base Point

   (while (or (not bn)
          (not (snvalid bn))
      ) ;_  end or
   (setq bn (getstring "Specify Block Name: "))
   ) ;_  end while

   (initget 1)
   (setq pt (getpoint "Specify Base Point for Block: "))

;;; Create BLOCK Header
   (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bn) (cons 70 0)))

;;;STEP THRU THE SET
   (setq i (sslength ss))
   (while (>= i (setq i (1- i)) 0)
   (setq ent   (ssname ss i)
         elist (entget ent)
   ) ;_  end setq
   (entmake elist)
   ) ;_  end while

;;;FINISH THE BLOCK DEFINITION
   (entmake (list (cons 0 "ENDBLK") (cons 8 "0")))

;;;Insert the Block & Delete Originals
   (entmake (list (cons 0 "INSERT") (cons 2 bn) (cons 8 "0") (cons 10 pt)))
   (command "_.ERASE" ss "")
   (redraw)
   (prin1)
) ;_  end defun

Posted

You will always need to specify a base point - whether it be the origin or another point - will you be using the origin every time?

 

My posted LISP will convert everything except objects that are either:

  • Blocks themselves
  • Viewports
  • Polylines

The block will need to be named something (even if I create a sequential naming program) (unless I somehow engineer it to create anonymous blocks - which tbh, I don't really know how to do).

 

Also, my LISP will create a block definition from the selected objects and store this block def in the active drawing - not to a separate filename.

Posted

Thanks for your reply, if I use your's lisp everytime when I select a group of object as a block then it will automatically specify the low left corner as a base point. And also automatically assign a name to it no matter the name of the block is. Then I can use the wblock.lisp write all block.

 

 

 

You will always need to specify a base point - whether it be the origin or another point - will you be using the origin every time?

 

My posted LISP will convert everything except objects that are either:

  • Blocks themselves
  • Viewports
  • Polylines

The block will need to be named something (even if I create a sequential naming program) (unless I somehow engineer it to create anonymous blocks - which tbh, I don't really know how to do).

 

Also, my LISP will create a block definition from the selected objects and store this block def in the active drawing - not to a separate filename.

Posted

This would seem to work:

 

(defun c:obj2blk1  (/ ss bi bn pt i ent elist)

 ; Get Entities

   (while (not ss)
   (princ "\nSelect Objects to Convert to Blocks:")
   (setq ss (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>")))))

 ; Get Block Name and Base Point

   (setq bi 1
     bn (strcat "BLOCK-" (itoa bi)))
   (while (or (not (snvalid bn)) (tblsearch "BLOCK" bn))
   (setq bn (strcat "BLOCK-" (itoa bi))
         bi (1+ bi)))

   (setq pt (getvar "extmin"))

;;; Create BLOCK Header
   (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bn) (cons 70 0)))

;;;STEP THRU THE SET
   (setq i (sslength ss))
   (while (>= i (setq i (1- i)) 0)
   (setq ent   (ssname ss i)
         elist (entget ent))
   (entmake elist))

;;;FINISH THE BLOCK DEFINITION
   (entmake (list (cons 0 "ENDBLK") (cons 8 "0")))

;;;Insert the Block & Delete Originals
   (entmake (list (cons 0 "INSERT") (cons 2 bn) (cons 8 "0") (cons 10 pt)))
   (command "_.ERASE" ss "")
   (redraw)
   (prin1))

 

This uses the lower left hand corner of the drawing extents as the base point and sequentially numbers blocks:

 

"BLOCK-1", "BLOCK-2".... etc etc

Posted

Dear Lee Mac,

 

Thank you very much !! this lisp very useful is reduce a lot of time.

 

Thanks again !!

 

Edmond

 

 

This would seem to work:

 

(defun c:obj2blk1  (/ ss bi bn pt i ent elist)

 ; Get Entities

   (while (not ss)
   (princ "\nSelect Objects to Convert to Blocks:")
   (setq ss (ssget '((-4 . "<NOT") (0 . "INSERT,POLYLINE,VIEWPORT") (-4 . "NOT>")))))

 ; Get Block Name and Base Point

   (setq bi 1
     bn (strcat "BLOCK-" (itoa bi)))
   (while (or (not (snvalid bn)) (tblsearch "BLOCK" bn))
   (setq bn (strcat "BLOCK-" (itoa bi))
         bi (1+ bi)))

   (setq pt (getvar "extmin"))

;;; Create BLOCK Header
   (entmake (list (cons 0 "BLOCK") (cons 10 pt) (cons 2 bn) (cons 70 0)))

;;;STEP THRU THE SET
   (setq i (sslength ss))
   (while (>= i (setq i (1- i)) 0)
   (setq ent   (ssname ss i)
         elist (entget ent))
   (entmake elist))

;;;FINISH THE BLOCK DEFINITION
   (entmake (list (cons 0 "ENDBLK") (cons 8 "0")))

;;;Insert the Block & Delete Originals
   (entmake (list (cons 0 "INSERT") (cons 2 bn) (cons 8 "0") (cons 10 pt)))
   (command "_.ERASE" ss "")
   (redraw)
   (prin1))

 

This uses the lower left hand corner of the drawing extents as the base point and sequentially numbers blocks:

 

"BLOCK-1", "BLOCK-2".... etc etc

Posted

My version.

Setub - convert selected entities to unnamed block (not edit in bedit command)

Setnb - convert selected entities to named block

(defun c:setub (/ ss adoc pt_lst center blk *error*)
;;;Selected Entities To Unnamed Block
 (defun *error* (msg)
   (vla-endundomark adoc)
   (princ msg)
   (princ)
   ) ;_ end of defun
 (vl-load-com)
 (vla-startundomark
   (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
   ) ;_ end of vla-StartUndoMark
 (if (not (vl-catch-all-error-p
            (vl-catch-all-apply '(lambda () (setq ss (ssget "_:L"))))
            ) ;_ end of vl-catch-all-error-p
          ) ;_ end of not
   (progn
     (setq
       ss     (mapcar 'vlax-ename->vla-object
                      (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
                      ) ;_ end of mapcar
       pt_lst (apply 'append
                     (mapcar
                       '(lambda (x / minp maxp)
                          (vla-getboundingbox x 'minp 'maxp)
                          (list (vlax-safearray->list minp)
                                (vlax-safearray->list maxp)
                                ) ;_ end of append
                          ) ;_ end of lambda
                       ss
                       ) ;_ end of mapcar
                     ) ;_ end of append
       center (mapcar '(lambda (a b) (/ (+ a b) 2.))
                      (list (apply 'min (mapcar 'car pt_lst))
                            (apply 'min (mapcar 'cadr pt_lst))
                            (apply 'min (mapcar 'caddr pt_lst))
                            ) ;_ end of list
                      (list (apply 'max (mapcar 'car pt_lst))
                            (apply 'max (mapcar 'cadr pt_lst))
                            (apply 'max (mapcar 'caddr pt_lst))
                            ) ;_ end of list
                      ) ;_ end of mapcar
       blk    (vla-add (vla-get-blocks adoc)
                       (vlax-3d-point center)
                       "*U"
                       ) ;_ end of vla-add
       ) ;_ end of setq
     (vla-copyobjects
       adoc
       (vlax-make-variant
         (vlax-safearray-fill
           (vlax-make-safearray vlax-vbobject (cons 0 (1- (length ss))))
           ss
           ) ;_ end of vlax-safearray-fill
         ) ;_ end of vlax-make-variant
       blk
       ) ;_ end of vla-copyobjects
     (vla-insertblock
       (vla-objectidtoobject adoc (vla-get-ownerid (car ss)))
       (vlax-3d-point center)
       (vla-get-name blk)
       1.0
       1.0
       1.0
       0.0
       ) ;_ end of vla-insertblock
     (mapcar 'vla-erase ss)
     ) ;_ end of and
   ) ;_ end of if
 (vla-endundomark adoc)
 (princ)
 ) ;_ end of defun

(defun c:setnb (/ ss adoc pt_lst center blk *error* bi bname bpat)
;;;Selected Entities To Named Block
 (setq bpat "BLOCK-") ;_ <- Edit block name pattern here
 (defun *error* (msg)
   (vla-endundomark adoc)
   (princ msg)
   (princ)
   ) ;_ end of defun
 (vl-load-com)
 (vla-startundomark
   (setq adoc (vla-get-activedocument (vlax-get-acad-object)))
   ) ;_ end of vla-StartUndoMark
 (if (not (vl-catch-all-error-p
            (vl-catch-all-apply '(lambda () (setq ss (ssget "_:L"))))
            ) ;_ end of vl-catch-all-error-p
          ) ;_ end of not
   (progn
     (setq
       ss     (mapcar 'vlax-ename->vla-object
                      (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
                      ) ;_ end of mapcar
       pt_lst (apply 'append
                     (mapcar
                       '(lambda (x / minp maxp)
                          (vla-getboundingbox x 'minp 'maxp)
                          (list (vlax-safearray->list minp)
                                (vlax-safearray->list maxp)
                                ) ;_ end of append
                          ) ;_ end of lambda
                       ss
                       ) ;_ end of mapcar
                     ) ;_ end of append
       center (mapcar '(lambda (a b) (/ (+ a b) 2.))
                      (list (apply 'min (mapcar 'car pt_lst))
                            (apply 'min (mapcar 'cadr pt_lst))
                            (apply 'min (mapcar 'caddr pt_lst))
                            ) ;_ end of list
                      (list (apply 'max (mapcar 'car pt_lst))
                            (apply 'max (mapcar 'cadr pt_lst))
                            (apply 'max (mapcar 'caddr pt_lst))
                            ) ;_ end of list
                      ) ;_ end of mapcar
       bname
       (progn
         (setq bi 0)
         (while (tblsearch "BLOCK" (setq bname (strcat bpat (itoa(setq bi(1+ bi)))))))
            bname)
       blk    (vla-add (vla-get-blocks adoc)
                       (vlax-3d-point center)
                       bname
                       ) ;_ end of vla-add
       ) ;_ end of setq
     (vla-copyobjects
       adoc
       (vlax-make-variant
         (vlax-safearray-fill
           (vlax-make-safearray vlax-vbobject (cons 0 (1- (length ss))))
           ss
           ) ;_ end of vlax-safearray-fill
         ) ;_ end of vlax-make-variant
       blk
       ) ;_ end of vla-copyobjects
     (vla-insertblock
       (vla-objectidtoobject adoc (vla-get-ownerid (car ss)))
       (vlax-3d-point center)
       (vla-get-name blk)
       1.0
       1.0
       1.0
       0.0
       ) ;_ end of vla-insertblock
     (mapcar 'vla-erase ss)
     ) ;_ end of and
   ) ;_ end of if
 (vla-endundomark adoc)
 (princ)
 ) ;_ end of defun

Posted
Dear Lee Mac,

 

Thank you very much !! this lisp very useful is reduce a lot of time.

 

Thanks again !!

 

Edmond

 

No probs Edmond - although VVA's LISP is way more advanced than mine - and uses unnamed blocks...

 

I only wish I was better at VL..

Posted

We really need to set some sysvars back to their respective defaults, otherwise the missing dxf codes go to the current settings:

[b][color=BLACK]([/color][/b]defun c:makeblk [b][color=FUCHSIA]([/color][/b]/ mkb_var mkb_rst bt bn bc ss i en ed in[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq mkb_var '[b][color=NAVY]([/color][/b][b][color=MAROON]([/color][/b][color=#2f4f4f]"ELEVATION"[/color] . 0[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b][color=#2f4f4f]"THICKNESS"[/color] . 0[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CELTSCALE"[/color] . 1[b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CECOLOR"[/color]   . [color=#2f4f4f]"BYLAYER"[/color][b][color=MAROON])[/color][/b]
                 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CELTYPE"[/color]   . [color=#2f4f4f]"BYLAYER"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]foreach v mkb_var
  [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]getvar [b][color=GREEN]([/color][/b]car v[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]setq mkb_rst [b][color=GREEN]([/color][/b]cons [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]car v[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]getvar [b][color=PURPLE]([/color][/b]car v[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] mkb_rst[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]setvar [b][color=GREEN]([/color][/b]car v[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]cdr v[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]initget [color=#2f4f4f]"Named Anonymous"[/color][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq bt [b][color=NAVY]([/color][/b]getkword [color=#2f4f4f]"\nBlock Type - Named/Anonymous <A>:   "[/color][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]not bt[b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]setq bt [color=#2f4f4f]"Anonymous"[/color][b][color=NAVY])[/color][/b]
     [b][color=NAVY]([/color][/b]progn
       [b][color=MAROON]([/color][/b]setq bn [color=#2f4f4f]"TEMP1"[/color] bc 1[b][color=MAROON])[/color][/b]
       [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] bn[b][color=GREEN])[/color][/b]
              [b][color=GREEN]([/color][/b]setq bc [b][color=BLUE]([/color][/b]1+ bc[b][color=BLUE])[/color][/b] bn [b][color=BLUE]([/color][/b]strcat [color=#2f4f4f]"TEMP"[/color] [b][color=RED]([/color][/b]itoa bc[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not ss[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]princ [color=#2f4f4f]"\nSelect Entities To Block:   "[/color][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"~VIEWPORT"[/color][b][color=BLUE])[/color][/b]
                              [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]getvar [color=#2f4f4f]"CTAB"[/color][b][color=RED])[/color][/b]
                                  [b][color=RED]([/color][/b]cons 410 [b][color=PURPLE]([/color][/b]getvar [color=#2f4f4f]"CTAB"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                                  [b][color=RED]([/color][/b]cons 67 [b][color=PURPLE]([/color][/b]- 1 [b][color=TEAL]([/color][/b]getvar [color=#2f4f4f]"TILEMODE"[/color][b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]entmake [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 0 [color=#2f4f4f]"BLOCK"[/color][b][color=MAROON])[/color][/b]
                [b][color=MAROON]([/color][/b]cons 2 [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]= bt [color=#2f4f4f]"Named"[/color][b][color=BLUE])[/color][/b] bn [color=#2f4f4f]"*U"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
                [b][color=MAROON]([/color][/b]cons 10 '[b][color=GREEN]([/color][/b]0 0 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
                [b][color=MAROON]([/color][/b]cons 70 [b][color=GREEN]([/color][/b]if [b][color=BLUE]([/color][/b]= bt [color=#2f4f4f]"Named"[/color][b][color=BLUE])[/color][/b] 0 1[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq i [b][color=NAVY]([/color][/b]sslength ss[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]minusp [b][color=GREEN]([/color][/b]setq i [b][color=BLUE]([/color][/b]1- i[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq en [b][color=MAROON]([/color][/b]ssname ss i[b][color=MAROON])[/color][/b]
              ed [b][color=MAROON]([/color][/b]entget en[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]entmake ed[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]assoc 66 ed[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]setq en [b][color=BLUE]([/color][/b]entnext en[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    [b][color=GREEN]([/color][/b]entmake [b][color=BLUE]([/color][/b]entget en[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]entdel [b][color=MAROON]([/color][/b]ssname ss i[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]setq in [b][color=NAVY]([/color][/b]entmake [b][color=MAROON]([/color][/b]list [b][color=GREEN]([/color][/b]cons 0 [color=#2f4f4f]"ENDBLK"[/color][b][color=GREEN])[/color][/b][b][color=GREEN]([/color][/b]cons 8 [color=#2f4f4f]"0"[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]entmake [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 0 [color=#2f4f4f]"INSERT"[/color][b][color=MAROON])[/color][/b][b][color=MAROON]([/color][/b]cons 2 in[b][color=MAROON])[/color][/b][b][color=MAROON]([/color][/b][color=MAROON][color=Black]cons 8 "0"[/color][/color][b][color=MAROON])([/color][/b]cons 10 '[b][color=GREEN]([/color][/b]0 0 0[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]foreach v mkb_rst [b][color=NAVY]([/color][/b]setvar [b][color=MAROON]([/color][/b]car v[b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]cdr v[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

[b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

This should handle heavy POLYLINEs and attributed INSERTs -David

Posted

David,

 

Does this:

 

[b][color=MAROON]([/color][/b]setq mkb_rst [b][color=GREEN]([/color][/b]cons [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]car v[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]getvar [b][color=PURPLE]([/color][/b]car v[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] mkb_rst[b][color=GREEN])[/color][/b][b][color=MAROON])
[/color][/b]

 

Create an associative list?

Posted
David,

 

Does this:

 

[b][color=MAROON]([/color][/b]setq mkb_rst [b][color=GREEN]([/color][/b]cons [b][color=BLUE]([/color][/b]cons [b][color=RED]([/color][/b]car v[b][color=RED])[/color][/b] [b][color=RED]([/color][/b]getvar [b][color=PURPLE]([/color][/b]car v[b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] mkb_rst[b][color=GREEN])[/color][/b][b][color=MAROON])
[/color][/b]

 

Create an associative list?

 

Exactly. A reset list of dotted pairs consisting of the sysvar and its current setting. Same format as mkb_var. -David

Posted

How does it know to put the "dot" in there and not just create:

[b][color=NAVY]([/color][/b][b][color=MAROON]([/color][/b][color=#2f4f4f]"ELEVATION"[/color] 0[b][color=MAROON])[/color][/b]
 [b][color=MAROON]([/color][/b][color=#2f4f4f]"THICKNESS"[/color] 0[b][color=MAROON])[/color][/b]
 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CELTSCALE"[/color] 1[b][color=MAROON])[/color][/b]
 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CECOLOR"[/color]  [color=#2f4f4f]"BYLAYER"[/color][b][color=MAROON])[/color][/b]
 [b][color=MAROON]([/color][/b][color=#2f4f4f]"CELTYPE"[/color]  [color=#2f4f4f]"BYLAYER"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])
[/color][/b]
Posted

Also, one more question, and sorry for all the posts, but:

 

when you make the attributes using:

 [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]assoc 66 ed[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]setq en [b][color=BLUE]([/color][/b]entnext en[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    [b][color=GREEN]([/color][/b]entmake [b][color=BLUE]([/color][/b]entget en[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])

 

1) could this be accomplished using an IF command?

2) would this not also make the "seqend" entity? - and if so, do you need to make this?

[/color][/b]

Posted

Lee,

 

Using (cons) with 2 atoms creates a dotted pair. It is unique to AutoLISP. Common lisp doesn't have dotted pairs. You would to use a (list) call to make the format you posted.

 

So I used 2 ( cons ) calls to make the list. 1st make the dotted pair, 2nd to add the dotted pair to the overall list. -David

Posted
Lee,

 

Using (cons) with 2 atoms creates a dotted pair. It is unique to AutoLISP. Common lisp doesn't have dotted pairs. You would to use a (list) call to make the format you posted.

 

So I used 2 ( cons ) calls to make the list. 1st make the dotted pair, 2nd to add the dotted pair to the overall list. -David

 

Ahh, I understand now thanks.

 

I initially assumed that "cons" was just for joining two lists together, but now I understand; thanks as always David.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


×
×
  • Create New...