Author Topic: Block filter specific to an attribute  (Read 4951 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Block filter specific to an attribute
« Reply #15 on: May 11, 2011, 08:26:50 AM »
Hi Kruuger,

There is nothing wrong with your code, but I just wanted to point out that it is more efficient to step through the SelectionSet only once, instead of twice, hence:

Code: [Select]
(defun c:test ( / ss st n ) 
  (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
    (if (setq st (getstring T "\nSpecify New Value: "))
      (repeat (setq n (sslength ss))
        (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" st)
      )
    )
  )
  (princ)
)

:-)



@Hugo,

Regarding Code posting have a read of this:

http://www.theswamp.org/index.php?topic=4429.0

Hugo

  • Bull Frog
  • Posts: 433
Re: Block filter specific to an attribute
« Reply #16 on: May 11, 2011, 08:40:51 AM »
So I get an error message but

So bekomme ich aber eine Fehlermeldung

Specify New Value: 1
; Fehler: Fehlerhafter Argumenttyp: VLA-OBJECT <Objektname: 7ffff6a1990>

Quote
(defun c:Raumbuch (/ SS st n)
  (if (setq SS (ssget "_x" '((0 . "INSERT") (66 . 1)))) ;"_:L"
    (if (setq ST (getstring T "\nSpecify New Value: "))
      (repeat (setq n (sslength ss))
        (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" ST)
      )
    )
  )
  (princ)
  )

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Block filter specific to an attribute
« Reply #17 on: May 11, 2011, 08:44:02 AM »
So I get an error message but

Use the original version of LM:SetAttributeValue that you posted.

Also, I again urge you to read this:

http://www.theswamp.org/index.php?topic=4429.0

Hugo

  • Bull Frog
  • Posts: 433
Re: Block filter specific to an attribute
« Reply #18 on: May 11, 2011, 08:53:17 AM »
@ Lee
Thanks works

How can I reach it I can make the selection with a "FPolygon.


@Lee
Danke funktioniert

Wie kann ich es erreichen das ich die Auswahl mit einer "FPolygon" erstellen kann.
   




Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Block filter specific to an attribute
« Reply #19 on: May 11, 2011, 08:57:16 AM »
Remove the '_X' from the ssget function.

Hugo

  • Bull Frog
  • Posts: 433
Re: Block filter specific to an attribute
« Reply #20 on: May 11, 2011, 09:02:49 AM »
So it is not able to create FPolygon  :-(
So geht es aber nicht kann keine FPolygon erstellen

Code: [Select]
(defun c:Raumbuch (/ SS st n)
  (if (setq SS (ssget '((0 . "INSERT") (66 . 1))))
    (if (setq ST (getstring T "\nSpecify New Value: "))
      (repeat (setq n (sslength ss))
        (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" ST)
      )
    )
  )
  (princ)
  )

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Block filter specific to an attribute
« Reply #21 on: May 11, 2011, 09:38:11 AM »
Type 'F' when prompted for selection  :-)

Hugo

  • Bull Frog
  • Posts: 433
Re: Block filter specific to an attribute
« Reply #22 on: May 11, 2011, 09:42:42 AM »
Thanks Lee

It is with us "FP". : lol:

Danke Lee

Es ist bei uns "FP".  :lol:

kruuger

  • Swamp Rat
  • Posts: 637
Re: Block filter specific to an attribute
« Reply #23 on: May 11, 2011, 10:01:43 AM »
Hi Kruuger,

There is nothing wrong with your code, but I just wanted to point out that it is more efficient to step through the SelectionSet only once, instead of twice, hence:

Code: [Select]
(defun c:test ( / ss st n ) 
  (if (setq ss (ssget "_X" '((0 . "INSERT") (66 . 1))))
    (if (setq st (getstring T "\nSpecify New Value: "))
      (repeat (setq n (sslength ss))
        (LM:SetAttributeValue (ssname ss (setq n (1- n))) "RAUM/GRUPPE" st)
      )
    )
  )
  (princ)
)

:-)



@Hugo,

Regarding Code posting have a read of this:

http://www.theswamp.org/index.php?topic=4429.0
yes, you are right
thanks  :-)
kruuger

Hugo

  • Bull Frog
  • Posts: 433
Re: Block filter specific to an attribute
« Reply #24 on: May 11, 2011, 12:23:14 PM »
@ Kruuger, Lee

Now it works great, thank you both.   :-) :-)

Jetzt funktioniert es super, danke an beide.