TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Fabricio28 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
-
-
(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)
)
-
very nice solution my old friend Ron,
Worked like a charm.
Thanks :)
-
+Kudo
-
Thanks guys :)
-
(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
-
(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 don't you make a block with an attribute?
-
Why don't you make a block with an attribute?
Because I've exploded that elements from autocad civil 3D. :-D
-
(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..
(setq circles (ssget "_X"
'((0 . "CIRCLE")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
; (8 . "-NRO-LOTE")
(100 . "AcDbCircle")
)
)
)
-
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.
-
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
-
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 ;)
-
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 :-)
-
Here's something to layer the circle & text objects based on your example drawing:
'((-4 . "<OR")
(-4 . "<AND")
(0 . "mtext")
(1 . "#,##")
(-4 . "AND>")
(-4 . "<AND")
(0 . "circle")
(-4 . "<=")
(40 . 1.5)
(-4 . "AND>")
(-4 . "OR>")
)
)
)
)
)
)
-
Here's something to layer the circle & text objects based on your example drawing:
'((-4 . "<OR")
(-4 . "<AND")
(0 . "mtext")
(1 . "#,##")
(-4 . "AND>")
(-4 . "<AND")
(0 . "circle")
(-4 . "<=")
(40 . 1.5)
(-4 . "AND>")
(-4 . "OR>")
)
)
)
)
)
)
Ron,
Fantastic!!!
Worked like a charm.
Thank you very much for the help. :)
Fabricio
-
:)