Author Topic: Automatically generated MLeader with "block name" text  (Read 1976 times)

0 Members and 1 Guest are viewing this topic.

Pan.Fazole

  • Guest
Automatically generated MLeader with "block name" text
« on: April 27, 2014, 06:46:05 PM »
Hello

i want to make lisp routine for automatic generate multileader with this requirements :

• mleader starting from object base point
• mleader text = block name
• for all blocks in .dwg (to start with lisp will be 1 object enough)
• position of mleader is not important for now

Example :



I have this this lisp :

Code - Auto/Visual Lisp: [Select]
  1. ;popiska názvu bloku - CAD Studio
  2. ;
  3. ;(setvar "DIMTXT" 10)
  4.  
  5. (defun C:BLeader ( / ss ent blkname pt)
  6.  (setvar "CMDECHO" 0)
  7.  (princ "\nSelect block:")
  8.  (setq ss (ssget "_+.:E:S" '((0 . "INSERT"))))
  9.  (if ss (progn
  10.   (setq ent (entget (ssname ss 0))
  11.         blkname (cdr (assoc 2 ent))
  12.         pt (cdr (assoc 10 ent)))
  13.   (princ (strcat blkname " - position: "))
  14.   (command "_LEADER" pt pause "" blkname "")
  15.  ));if
  16.  (setvar "CMDECHO" 1)
  17.  (prin1)
  18. )
  19.  
  20. (princ "\n BLeader loaded.")

---

But this is not what i want. Here i have to clicking to objects and positions, but i need automatically generating multileaders.
I will be very grateful if someone help me or show me some right direction...
Sorry for my english.

ChrisCarlson

  • Guest
Re: Automatically generated MLeader with "block name" text
« Reply #1 on: April 28, 2014, 07:58:43 AM »
Code: [Select]
(defun C:partnogen (/ pt01)
(setq partnumber (getstring "\nEnter Part Number: "))
(entmake
(list
(cons 0 "BLOCK") ; entity
(cons 2 partnumber) ; block name
(cons 70 2) ; block type
(list 10 0.0 0.0 0.0) ; base point 
) ; end list
) ; end entmake
(entmake
(list
(cons 0 "TEXT") ; entity
(cons 8 "SYS-Bom_Part_Numbers") ; layer
(list 10 0.0 0.0 0.0) ; base point
(cons 40 0.035) ; text height
(cons 1 partnumber) ; text string
(cons 50 0)  ; text rotation
; (cons 7 "STANDARD")   ; text style
(cons 72 10) ; text justification
) ; end list
) ; end entmake text
)

Here's my code I have for creating a block with text, hope it might help.  I'm not sure how similar mleader creation is to block creation though.