Author Topic: Linetype scale  (Read 7199 times)

0 Members and 1 Guest are viewing this topic.

2e4lite

  • Guest
Linetype scale
« on: April 26, 2014, 02:21:31 AM »
   I has been trouble  in the  linetype scale all along .  Those of some lines such as CENTER and DASH  shown with continuous. The length of objects have a large range in a drawing .So I want  a lisp routine that can automatically adjust it using the proper  scales according  to the length of  every object for the whole drawing . It will go a long way in my work . How to acheive it?
« Last Edit: April 29, 2014, 03:20:48 AM by 2e4lite »

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
Re: Linetype scale
« Reply #1 on: April 26, 2014, 07:24:54 AM »
Why not start by doing a little searching on here, Google and the other CAD sites....

2e4lite

  • Guest
Re: Linetype scale
« Reply #2 on: April 26, 2014, 09:27:18 PM »
I 've done it ,but some  lisp routines  are not to adjust the  scales  by  length,it is different from what I want.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Linetype scale
« Reply #3 on: April 26, 2014, 10:07:19 PM »

Computer programs need rules.

To achieve what you want : What are the rules, exactly ?

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

2e4lite

  • Guest
Re: Linetype scale
« Reply #4 on: April 26, 2014, 10:36:07 PM »
 Thanks to Kerry, Perhaps the words have a distance . I just want to achive the result like the following attachment.(ps: It also effect to block)
« Last Edit: April 28, 2014, 09:39:00 PM by 2e4lite »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Linetype scale
« Reply #5 on: April 26, 2014, 10:47:41 PM »

Great pictures, but what are the rules ?

What LineTypeScale do you want to use for different length lines ?
Does your setup change the global LTSCALE variable depending on DIMSCALE for the document ?
Can we assume you want to select the lines to modify ?

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

2e4lite

  • Guest
Re: Linetype scale
« Reply #6 on: April 26, 2014, 11:40:18 PM »
   Under the result premise ,You can have a think to the rules.Whatever LineType scales will to be set , I think , It is good as long as it can be easily distinguish between non-continuous and continuous shown on computer and in drawing sheet .It seems not change the global LTSCALE variable depending on DIMSCALE for the document .We usually draw the plant using the scale of 1:1 . the DIMSCALE and ltscale are set 1 in general . It is required to have two chooses to modify the non-continuous for users: to modify the whole drawing automatically (default) and to give ranges in the drawing to modify automatically.
« Last Edit: April 30, 2014, 01:47:23 AM by 2e4lite »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Linetype scale
« Reply #7 on: April 26, 2014, 11:56:49 PM »

OK, so you want to set the individual LinetypeScale property for specific objects.


What LineTypeScale do you want to use for different length lines ?

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

2e4lite

  • Guest
Re: Linetype scale
« Reply #8 on: April 27, 2014, 12:22:38 AM »
Yeah...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Linetype scale
« Reply #9 on: April 27, 2014, 07:46:07 PM »

The path to quality software begins with excellent requirements. Slighting the processes of requirements development and management is a common cause of software project frustration and failure.


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Linetype scale
« Reply #10 on: April 28, 2014, 10:19:02 AM »

The path to quality software begins with excellent requirements. Slighting the processes of requirements development and management is a common cause of software project frustration and failure.



My version: code is the end result, not the starting point.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Linetype scale
« Reply #11 on: April 29, 2014, 04:13:37 AM »
You could try this I suppose
Code - Auto/Visual Lisp: [Select]
  1. (defun Get-Entity-Linetype  (eObj / lt)
  2.   (if (wcmatch (strcase (setq lt (vla-get-LineType eObj))) "BYLAYER")
  3.     (cdr (assoc 6 (tblsearch "LAYER" (vla-get-Layer eObj))))
  4.     lt))
  5.  
  6. (defun Get-LineType-Pattern-Length  (ltName)
  7.   (apply '+
  8.          (mapcar '(lambda (c)
  9.                     (cond ((= (car c) 49) (abs (cdr c)))
  10.                           (t 0)))
  11.                  (tblsearch "LTYPE" ltName))))
  12.  
  13. (defun Set-Entity-Min-LtScale  (eName / eObj len ltlen)
  14.     (setq eObj (vlax-ename->vla-object eName))
  15.     (if (< (setq len (vla-get-Length eObj))
  16.            (setq ltlen (Get-LineType-Pattern-Length (Get-Entity-Linetype eObj))))
  17.       (/ len ltlen)
  18.       1.0)))
  19.  
  20. (defun c:SetMinLtScales  (/ ss n)
  21.   (if (setq ss (ssget '((0 . "LINE"))))
  22.     (repeat (setq n (sslength ss)) (Set-Entity-Min-LtScale (ssname ss (setq n (1- n))))))
  23.   (princ))
Should work for Lines. Might need a bit more for other types of objects (e.g. circles / arcs / polylines / etc.)
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Linetype scale
« Reply #12 on: April 29, 2014, 04:15:25 AM »
You could try this I suppose
Code - Auto/Visual Lisp: [Select]
  1. (defun Get-Entity-Linetype  (eObj / lt)
  2.   (if (wcmatch (strcase (setq lt (vla-get-LineType eObj))) "BYLAYER")
  3.     (cdr (assoc 6 (tblsearch "LAYER" (vla-get-Layer eObj))))
  4.     lt))
  5.  
  6. (defun Get-LineType-Pattern-Length  (ltName)
  7.   (apply '+
  8.          (mapcar '(lambda (c)
  9.                     (cond ((= (car c) 49) (abs (cdr c)))
  10.                           (t 0)))
  11.                  (tblsearch "LTYPE" ltName))))
  12.  
  13. (defun Set-Entity-Min-LtScale  (eName / eObj len ltlen)
  14.     (setq eObj (vlax-ename->vla-object eName))
  15.     (if (< (setq len (vla-get-Length eObj))
  16.            (setq ltlen (Get-LineType-Pattern-Length (Get-Entity-Linetype eObj))))
  17.       (/ len ltlen)
  18.       1.0)))
  19.  
  20. (defun c:SetMinLtScales  (/ ss n)
  21.   (if (setq ss (ssget '((0 . "LINE"))))
  22.     (repeat (setq n (sslength ss)) (Set-Entity-Min-LtScale (ssname ss (setq n (1- n))))))
  23.   (princ))
Should work for Lines. Might need a bit more for other types of objects (e.g. circles / arcs / polylines / etc.)
And you'd need to accommodate for the global LTScale factor, or even the paper-space factor (if PSLTSCale=1) or even worse - what about AnnoScales?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Linetype scale
« Reply #13 on: April 29, 2014, 05:40:14 AM »
< .. >
And you'd need to accommodate for the global LTScale factor, or even the paper-space factor (if PSLTSCale=1) or even worse - what about AnnoScales?

Yes.

And there is still my original question .. What individual LTScale will be used for differing line lengths.
And he'd need to consider several different line types and variation in stroke length within each basic type.

The actual code is pretty basic ... setting the rules is where the work needs to be done.

It astounds me that anyone can ask [us] to code a routine like this and is not prepared to do the work involved in actually explain what is required.

Some problems are interesting in themselves technically and are worth spending the time on, but I really hate wasting time trying to extract basic design data related to the problem.
I see it all too often and it continues to piss me off.
« Last Edit: April 29, 2014, 05:46:16 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

tedg

  • Swamp Rat
  • Posts: 811
Re: Linetype scale
« Reply #14 on: April 29, 2014, 11:06:05 AM »
..
It astounds me that anyone can ask [us] to code a routine like this and is not prepared to do the work involved in actually explain what is required.

Some problems are interesting in themselves technically and are worth spending the time on, but I really hate wasting time trying to extract basic design data related to the problem.
I see it all too often and it continues to piss me off.
I'm not sure the op got the hint ....
 
"Hey 2e4lite, can you respond with a clear explaination of what you would like for the rules for this program to run under, and maybe you could get some help here?"
Windows 10 Pro 64bit, AutoCAD 2023, REVIT 2023