Author Topic: Change LineType Scale...  (Read 2553 times)

0 Members and 1 Guest are viewing this topic.

MeasureUp

  • Bull Frog
  • Posts: 462
Change LineType Scale...
« on: December 22, 2010, 06:32:28 PM »
There is no problems when changing linetype scale by selecting object on the screen.
Quote
command: chprop -> select object -> "s"
But this won't work when writing to the code.
For example, I want to change the selected object to
1) Layer: steel
2) Linetype Scale: 0.5
And the following is what I get.
Code: [Select]
(command "._chprop" "last" "" "layer" "Steel" "" "S" "0.5")
Quote
Command: ._chprop
Select objects: last 1 found

Select objects:
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
layer
Enter new layer name <Dims>: Steel
Enter property to change
[Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:
Command: S Unknown command "S".  Press F1 for help.

Command: 0.5 Unknown command "5".  Press F1 for help.

Does anyone has a solution?
Thanks for your help.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Change LineType Scale...
« Reply #1 on: December 22, 2010, 06:39:46 PM »
Move the quotes between "Steel" and "S" to the end:

(command "._chprop" "last" "" "layer" "Steel" "S" "0.5" "")

MeasureUp

  • Bull Frog
  • Posts: 462
Re: Change LineType Scale...
« Reply #2 on: December 22, 2010, 07:10:49 PM »
Move the quotes between "Steel" and "S" to the end:

(command "._chprop" "last" "" "layer" "Steel" "S" "0.5" "")
That is it.
Thank you very much & merry Christmas.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Change LineType Scale...
« Reply #3 on: December 23, 2010, 05:46:54 AM »
Should you want to approach it another way  :-)

Code: [Select]
(defun c:test ( / ss i )

  (if (setq ss (ssget "_L"))
    (repeat (setq i (sslength ss))
      (entupd
        (cdr
          (assoc -1
            (_UpdateDXF  48 0.5
              (_UpdateDXF 8 "Steel"
                (entget (ssname ss (setq i (1- i))))
              )
            )
          )
        )
      )
    )
  )

  (princ)
)

(defun _UpdateDXF ( code value elist )
  (cond ( (entmod (list (assoc -1 elist) (cons code value))) ) ( elist ))
)

Merry Christmas guys!  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Change LineType Scale...
« Reply #4 on: December 23, 2010, 08:51:10 AM »
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.

Also, you shouldn't need to step through the selection set since (ssget "_L") will only select the last object - (ssname ss 0) should suffice, or am I just wrong?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Change LineType Scale...
« Reply #5 on: December 23, 2010, 09:34:21 AM »
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.

I've found it works in most cases, but not when updating MText formatting, or on non-graphical entities such as layers etc.

Also, you shouldn't need to step through the selection set since (ssget "_L") will only select the last object - (ssname ss 0) should suffice, or am I just wrong?

Good point, I think does only collect one entity - oh well, at least its open for easy modification should the user want to change it  :-)
« Last Edit: December 23, 2010, 09:44:57 AM by Lee Mac »

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Change LineType Scale...
« Reply #6 on: December 23, 2010, 10:15:43 AM »
Do you find inconsistencies in using entmod that way? I tried it a few weeks back, but it didn't work on LWPolylines and randomly didn't work on Lines.

I've found it works in most cases, but not when updating MText formatting, or on non-graphical entities such as layers etc.
Well, not working on LWPolylines and sometimes on Lines is enough for me to not use it. I was curious if it was only me or you had similar results.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox