(defun c:MakeBlock (/ bkn eee i ndx nm ssst st)
(if (and (setq ssst (ssget)) (setq st (getpoint "\nPick Base Point: ")))
(progn (setq ndx 0)
(setq time (rtos (getvar "CDATE") 2 6)) ; Format YYYYMMDD.HHMMSS
(setq year (substr time 3 2)) ; Two digits instead of four
(setq month (substr time 5 2))
(setq day (substr time 7 2))
(setq hour (substr time 10 2)) ; Increment of 3 from day to account for "." character
(setq minutes (substr time 12 2))
(setq seconds (substr time 14 2))
(while (tblobjname "block" (setq nm (strcat "Block-" year month day hour minutes seconds))))
(entmake (list '(0 . "BLOCK")
'(100 . "AcDbEntity")
'(67 . 0)
'(8 . "0")
'(100 . "AcDbBlockReference")
(cons 2 nm)
(cons 10 st)
'(70 . 0)
)
)
(repeat (sslength ssst)
(entmake (cdr (entget (ssname ssst ndx))))
(entdel (ssname ssst ndx))
(setq ndx (+ 1 ndx))
)
(entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0")))
(entmake (list (cons 0 "INSERT")
(cons 2 nm)
(cons 6 (getvar "CELTYPE"))
(cons 8 (getvar "CLAYER"))
(cons 66 0)
(cons 10 st)
(cons 41 1)
(cons 42 1)
(cons 43 1)
(cons 50 0)
(cons 71 0)
(cons 44 0)
(cons 45 0)
)
)
)
)
(princ)
)
You want to have multiple unique blocks?Yes they are all unique. That's the reason for the date stamp, may not be the best method but it works for me.
why not just make a dynamic blockA regular block is better, as I edit by "Edit block in place" command, and can see other objects in the background.
Hi, thanks this is getting close.
- How do you make it Escape automatically so it only runs once.
Is this what the "If" is supposed to do? If I change "While" to "If", it doesn't work, it says Unknown command.
- Also how do you place circle inside the block in the layer named Fulcrum. The block is in then in the current layer.
Just a side comment why not just make a block with a circle rad 1 then use scale to change.Agreed .. and make it scale uniformly.
Was there a way to use diameter as well as another option?
@mhuppWas there a way to use diameter as well as another option?
CBR for radius
CBD for diameterCode - Auto/Visual Lisp: [Select]
;;----------------------------------------------------------------------;; ... ;;----------------------------------------------------------------------;; ;; CREATE CIRCLE BLOCKS WITH UNIQE NAME DIA ) ) )
This is finally working, I don't know why it wasn't before as LSP file was saved after changes.What do you use these for? Have you thought about using a circle block ( as mentioned above ) then changing the scale to get the correct size? Then you wouldn't have a bunch of blocks with different names that look the same but only have a different radius.
Was there a way to use diameter as well as another option?
@mhupp
FWIW, you should check the existence of the number before dividing otherwise it'll throw an error. I also like to use GETDIST for these types of inputs since you can enter a number as well as pick two points :)Code - Auto/Visual Lisp: [Select]
What do you use these for? Have you thought about using a circle block ( as mentioned above ) then changing the scale to get the correct size? Then you wouldn't have a bunch of blocks with different names that look the same but only have a different radius.What I often do is create blocks from scratch. As a base point, I draw a circle and place it in a layer that is not printed (in this case Fulcrum). Then make it into a block manually.