Author Topic: Select the similiar  (Read 4284 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 666
Select the similiar
« on: February 16, 2017, 11:06:44 AM »
Hi all,

I have 2 different MText in my drawing.
- Area
- Lot Number

But this MText is the same layer "-AREA-LOTES".
I'd like to select all MText to Lot Numbers and change to "-NRO-LOTE" layer.

Is it possible?

I was trying to use select the similiar. But I couldn't do that.

Thank in advance
Fabricio

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Select the similiar
« Reply #1 on: February 16, 2017, 11:19:25 AM »
Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil (ssget "_x" '((0 . "mtext") (1 . "#,##"))))

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Select the similiar
« Reply #2 on: February 16, 2017, 11:23:01 AM »
Code: [Select]
(defun c:SSIM (/ circles #count centerp item Mtexts MtextObject vlaitem)
  (setq circles (ssget "_X"
       '((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
  )
  (repeat (setq #count (sslength circles))
    (setq item (ssname circles (setq #count (1- #count))))
    (setq centerp (assoc 10 (entget item)))
    (if (setq Mtexts (ssget "_X"
    (list
      '(0 . "MTEXT")
      centerp
    )
     )
)
      (progn
(setq MtextObject (ssname Mtexts 0))
(setq vlaitem (vlax-ename->vla-object MTextobject))
(vla-put-layer vlaitem "-NRO-LOTE")
      )
    )

  )
  (princ)
)
Keep smile...

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #3 on: February 16, 2017, 11:23:48 AM »
Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil (ssget "_x" '((0 . "mtext") (1 . "#,##"))))

very nice solution my old friend Ron,

Worked like a charm.

Thanks :)

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Select the similiar
« Reply #4 on: February 16, 2017, 11:24:47 AM »
Code - Auto/Visual Lisp: [Select]
  1. (sssetfirst nil (ssget "_x" '((0 . "mtext") (1 . "#,##"))))

+Kudo
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Select the similiar
« Reply #5 on: February 16, 2017, 11:27:48 AM »
Thanks guys :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #6 on: February 16, 2017, 11:29:04 AM »
Code: [Select]
(defun c:SSIM (/ circles #count centerp item Mtexts MtextObject vlaitem)
  (setq circles (ssget "_X"
       '((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
  )
  (repeat (setq #count (sslength circles))
    (setq item (ssname circles (setq #count (1- #count))))
    (setq centerp (assoc 10 (entget item)))
    (if (setq Mtexts (ssget "_X"
    (list
      '(0 . "MTEXT")
      centerp
    )
     )
)
      (progn
(setq MtextObject (ssname Mtexts 0))
(setq vlaitem (vlax-ename->vla-object MTextobject))
(vla-put-layer vlaitem "-NRO-LOTE")
      )
    )

  )
  (princ)
)

Wow :)
Very Nice too Andrea!!

Thank you very much.
Fabricio

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #7 on: February 16, 2017, 11:34:40 AM »
Code: [Select]
(defun c:SSIM (/ circles #count centerp item Mtexts MtextObject vlaitem)
  (setq circles (ssget "_X"
       '((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
  )
  (repeat (setq #count (sslength circles))
    (setq item (ssname circles (setq #count (1- #count))))
    (setq centerp (assoc 10 (entget item)))
    (if (setq Mtexts (ssget "_X"
    (list
      '(0 . "MTEXT")
      centerp
    )
     )
)
      (progn
(setq MtextObject (ssname Mtexts 0))
(setq vlaitem (vlax-ename->vla-object MTextobject))
(vla-put-layer vlaitem "-NRO-LOTE")
      )
    )

  )
  (princ)
)

If the circle were in the " -AREA-LOTE" the code isn't working.

My first step is change the circle and the number to "-NRO-LOTE".
But I can select the similar all circle and change the layer as I want to. But couldn't do that to the number.

Will be good if I able to change boths (circle and Number) to "-NRO-LOTE" layer.

Thanks

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Select the similiar
« Reply #8 on: February 16, 2017, 11:38:17 AM »
Why don't you make a block with an attribute?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #9 on: February 16, 2017, 11:43:22 AM »
Why don't you make a block with an attribute?

Because I've exploded that elements from autocad civil 3D.  :-D


Andrea

  • Water Moccasin
  • Posts: 2372
Re: Select the similiar
« Reply #10 on: February 16, 2017, 11:48:05 AM »
Code: [Select]
(defun c:SSIM (/ circles #count centerp item Mtexts MtextObject vlaitem)
  (setq circles (ssget "_X"
       '((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
  )
  (repeat (setq #count (sslength circles))
    (setq item (ssname circles (setq #count (1- #count))))
    (setq centerp (assoc 10 (entget item)))
    (if (setq Mtexts (ssget "_X"
    (list
      '(0 . "MTEXT")
      centerp
    )
     )
)
      (progn
(setq MtextObject (ssname Mtexts 0))
(setq vlaitem (vlax-ename->vla-object MTextobject))
(vla-put-layer vlaitem "-NRO-LOTE")
      )
    )

  )
  (princ)
)

If the circle were in the " -AREA-LOTE" the code isn't working.

My first step is change the circle and the number to "-NRO-LOTE".
But I can select the similar all circle and change the layer as I want to. But couldn't do that to the number.

Will be good if I able to change boths (circle and Number) to "-NRO-LOTE" layer.

Thanks

why do not mix both code ?
my filtering object is to detext all circle and compare centerpoints to MTEXT who have same centerpoints..

but you can use Ron filtering selection.. :)
or,..
remove the layer filtering..
Code: [Select]
(setq circles (ssget "_X"
       '((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
; (8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
  )
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Select the similiar
« Reply #11 on: February 16, 2017, 11:51:03 AM »
Why don't you make a block with an attribute?

Because I've exploded that elements from autocad civil 3D.  ;D
>:D  .. this is how I'd do it.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #12 on: February 16, 2017, 12:00:17 PM »
Why don't you make a block with an attribute?

Because I've exploded that elements from autocad civil 3D.  ;D
>:D  .. this is how I'd do it.

Wow!

Do you make a block with the circles and numbers. How could you do that?

Amazing

ronjonp

  • Needs a day job
  • Posts: 7526
Re: Select the similiar
« Reply #13 on: February 16, 2017, 12:07:37 PM »
Why don't you make a block with an attribute?

Because I've exploded that elements from autocad civil 3D.  ;D
>:D  .. this is how I'd do it.

Wow!

Do you make a block with the circles and numbers. How could you do that?

Amazing
Code  ;)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Fabricio28

  • Swamp Rat
  • Posts: 666
Re: Select the similiar
« Reply #14 on: February 16, 2017, 12:23:32 PM »
Why don't you make a block with an attribute?

Because I've exploded that elements from autocad civil 3D.  ;D
>:D  .. this is how I'd do it.

Wow!

Do you make a block with the circles and numbers. How could you do that?

Amazing
Code  ;)

I see...
Very impressive  :-)