Create Group of block and mtext

Create Group of block and mtext

jan_tappenbeck
Collaborator Collaborator
490 Views
7 Replies
Message 1 of 8

Create Group of block and mtext

jan_tappenbeck
Collaborator
Collaborator

hi!

 

i want to create a simple group of a mtext and a block insert.

 

the objectID's are my information ...

 

did someone had an idea?

 

regards Jan

0 Likes
491 Views
7 Replies
Replies (7)
Message 2 of 8

komondormrex
Mentor
Mentor

hi,

a group out of existing insert and mtext?

 

0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

Are the "objectID's" that you have their entity names, such as would be returned by (entlast) or (car (entsel "\nSelect a Block insertion or Mtext object: "))?  And how do you have them as information?  Are they stored in AutoLisp variables?  Are they already in an AutoLisp selection set together?  An AutoLisp list?  An external file of some kind?  Etc., etc.

 

Do you want the Group to be named ?

Kent Cooper, AIA
0 Likes
Message 4 of 8

jan_tappenbeck
Collaborator
Collaborator
yes of existing entities.

Jan
0 Likes
Message 5 of 8

jan_tappenbeck
Collaborator
Collaborator
the objectid's are long values.

example:
Dim MTextId As New ObjectId
MTextId = acBlkTblRec.AppendEntity(acMText)

jan
0 Likes
Message 6 of 8

Kent1Cooper
Consultant
Consultant

@jan_tappenbeck wrote:
the objectid's are long values.
example:
Dim MTextId As New ObjectId
MTextId = acBlkTblRec.AppendEntity(acMText)

I'm not familiar with that kind of identifier.  Where does it come from?  How do you get it from the object?

 

Also, it all looks very generic.  Is it any different for one Mtext [or other] object than it is for a different one?  I would expect something probably numerical or hexadecimal as part of it, that would differ between the ObjectId's of different objects.

Kent Cooper, AIA
0 Likes
Message 7 of 8

CADaSchtroumpf
Advisor
Advisor

This ?

(defun c:jan_group ( / ss_blk ss_mtxt lst_grp newdict xname)
  (princ "\nSelect a block insert")
  (while (null (setq ss_blk (ssget "_+.:E:S" '((0 . "INSERT")))))
    (princ "\nIsn't a block insert")
  )
  (princ "\nSelect a MText")
  (while (null (setq ss_mtxt (ssget "_+.:E:S" '((0 . "MTEXT")))))
    (princ "\nIsn't a MText")
  )
  (setq
    lst_grp (cons (cons 340 (ssname ss_blk 0)) lst_grp)
    lst_grp (cons (cons 340 (ssname ss_mtxt 0)) lst_grp)
  )
  (setq
    newdict (cdar (dictsearch (namedobjdict) "ACAD_GROUP"))
    xname
    (entmakex
      (append
        '(
          (0 . "GROUP")
          (100 . "AcDbGroup")
          (300 . "Block and MText")
          (70 . 0)
          (71 . 1)
        )
        lst_grp
      )
    )
  )
  (if (not (assoc 3 (dictsearch (namedobjdict) "ACAD_GROUP")))
    (dictadd newdict "BLOCK-MTEXT_1" xname)
    (dictadd newdict (strcat "BLOCK-MTEXT_" (itoa (1+ (atoi (substr (cdr (assoc 3 (dictsearch (namedobjdict) "ACAD_GROUP"))) 11))))) xname)
  )
  (prin1)
)
0 Likes
Message 8 of 8

jan_tappenbeck
Collaborator
Collaborator

thanks for answer.

 

i forgot to write i use a way in vb.net.

 

regards Jan

0 Likes