Jump to content

Recommended Posts

Posted

Hi i am using this lisp code to insert a fence linetype in my drawings.I have a litle problem because a use a lot of lines. The problem is when i give

(setvar "LTSCALE" 6) then the global scale factor in linetype settings convert to 6. When i insert enothe line type with (setvar "LTSCALE" 2) the global scale factor convert to 2. And the become a mess. I want to change the line type scale in properties menu to 6 or 2 not the global scale factor. When i select a line of then the linetype scale in properties menu is 1.

 

(DEFUN C:SYR2 (/ CONVERT KLIM OLD_CLT S1 S2 SCL SS)
 (setq old_clt (getvar 'CELTYPE))
 (if (and (not (tblsearch "ltype" "fence"))
   (findfile "C:\\topocad\\topo.lin")
     )
   (command "-linetype" "l" "fence" "C:\\topocad\\topo.lin" "")
 )
 (if (tblsearch "ltype" "fense")
   (progn
     (setq ss (ssadd))
     (COMMAND "_layer" "_m" "_fense" "_c" "140" "_fense" "_lt" "fense" "fense" "")
     (SETQ KLIM 1)
     (COMMAND "_linetype" "_s" "fense" "")
     (setvar "PSLTSCALE" 1)
     (setvar "LTSCALE" 6)
     (setvar "MSLTSCALE" 1)
     (SETQ S1 (GETPOINT "\ngive the first point :"))
     (WHILE (SETQ S2 (GETPOINT S1 "\ngive the second point :"))
(COMMAND "_line" "non" S1 "non" S2 "")
(COMMAND "_CHPROP" (ENTLAST) "" "_S" KLIM "")
(ssadd (ENTLAST) ss)
(SETQ S1 S2)
     )
     (setvar 'CELTYPE old_clt)
     (initget "Yes No")
     (if (and (setq
  convert (cond
     ((getkword "\nconvert to polyline? [Yes/No] <N>: "))
     ("No")
   )
       )
       (/= (sslength ss) 0)
       (= convert "Yes")
  )
(if (= (getvar 'PEDITACCEPT) 0)
  (command "_.pedit" "_M" ss "" "_Y" "_J" "" "")
  (command "_.pedit" "_M" ss "" "_J" "" "")
)
     )
   )
 )
 (princ)
)

Posted

The variable you need to change is called "celweight" (It sets the lineweight of new objects.)

Store the initial celweight value to a local variable

Change celweight to match the line weight override you want new objects to have

Change celweight back to initial value.

 

I also advise making an error trapping to revert values to their original values, if the user hit escape and exits the command.

Posted

I dont want to change the line weight .I want to change the linetype scale !!!!

Posted

I want to change the linetype scale only in properties general tab

Posted

my bad. Check the celtscale variable instead. (Sets the current object linetype scaling factor)

Posted

I ask my question wrong !!!!

I have some lines in a *.lin file

Each line for example scale 1:200 need to have a different linetype scale. For example fence need linetype scale 5 and the dot nile needs line type scale 2.

When i insent a fence the global scale factor become 5 .And after that i insert a dot line and the global scale factor become 2 for all the lines. The problem is , any time i insert a new line the global scale factor change for all the lines. And then become a mess.Is any way eatch line keep his own global scale factor ? What to do to fix my lines. I use annotated scales and layouts

Posted (edited)

By definition each linetype cannot have a "global" scale factor. What you want is for each different linetype to have its own unique scale factor. Can't this be accomplished through the use of Tool Palettes?

 

Addendum.

 

I just answered my own question. I enabled Tool Palettes and clicked on the Draw tab. I copied the Line command and rename this copy HiddenLine. I right-clicked on it and changed the properties for both linetype (Hidden) and scale (5 instead of 1). I then tested it. Success. The global LTSCALE factor remained at 1.

 

Lisp does not have to be the solution for every problem under the sun. Sometimes a more straightforward (i.e. - simple) approach will do just as well.

Edited by ReMark
Posted

Yes but if ic hangr manual the linetype scale prom the properties and the global scale remain 1, if i change the annotation scale i still have the same linetype scale. I will see no change !!!

Posted (edited)

I see a change so I don't know what you are referring to.

 

Are you using a layout and applying a scale to the viewport?

 

As seen in model space. The yellow line at the top was drawn on a layer named Test which was assigned the Hidden linetype. LTSCALE is 1. The white line below it was drawn on layer 0 which normally uses the Continuous linetype HOWEVER I used my recently created HiddenLine tool which, as noted in its Properties, had its linetype changed to Hidden and the scale changed to 5. LTSCALE remains at 1.

 

Modelspace LT scale.jpg

Edited by ReMark
Posted

Same two lines as seen in a layout with a viewport (magenta color) scale of 1:2. LTSCALE has not been changed. It is still 1.

 

Paperspace LT scale.jpg

Posted

I find it . I will change

 

(SETQ KLIM 1)
     (COMMAND "_linetype" "_s" "fense" "")
     (setvar "PSLTSCALE" 1)
     (setvar "LTSCALE" 6)
     (setvar "MSLTSCALE" 1)

 

with

 

(SETQ KLIM 6)
     (COMMAND "_linetype" "_s" "fense" "")
     (setvar "PSLTSCALE" 1)
     (setvar "LTSCALE" 1)
     (setvar "MSLTSCALE" 1)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...