Jump to content

HELP: LISP to Change linetype scale for enity in blocks & nested blocks


vernonlee

Recommended Posts

Currently using a LISP to change all line/entity to linetype scale 5. But it does not work more then 1 or 2 level nested deep.

 

Any can help design one that can change all linetype scale in 1 click?

 

Thanks

 

This is the current LISP i am using:-

 

(vl-load-com)
   (defun c:sst (/ ss scale blk eo doc blocks bcol)
     (if (and (setq scale (getreal "New scale: "))
              (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
              (setq ss (ssget))
              (setq ss (vla-get-ActiveSelectionSet doc))
         )
       (progn
         (vlax-for eo ss
           (if (vlax-property-available-p eo 'LinetypeScale t)
             (vla-put-LinetypeScale eo scale)
           )
           (if (and (eq (vla-get-ObjectName eo) "AcDbBlockReference")
                    (not (vl-position (vla-get-EffectiveName eo) blocks))
               )
             (setq blocks (cons (vla-get-EffectiveName eo) blocks))
           )
         )
         (setq bcol (vla-get-Blocks doc))
         (foreach blk blocks
           (vlax-for eo (vla-Item bcol blk)
             (if (vlax-property-available-p eo 'LinetypeScale t)
               (vla-put-LinetypeScale eo scale)
             )
           )
         )
       )
     )
     (princ)
   )

Reply With Quote 

(prompt "Enter sst to run.")
(princ)

Link to comment
Share on other sites

Change the linetype scale for all objects in the drawing, or all objects in a selection?

 

All object in the drawing for the most part. There are a few occasions where I do need to select though. Thanks

Link to comment
Share on other sites

All object in the drawing for the most part.

 

Try the following:

(defun c:lts ( / doc scl )
   (initget 6)
   (if (setq scl (getreal "\nSpecify new linetype scale: "))
       (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
           (if (= :vlax-false (vla-get-isxref blk))
               (vlax-for obj blk
                   (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
                       (vla-put-linetypescale obj scl)
                   )
               )
           )
       )
   )
   (vla-regen doc acallviewports)
   (princ)
)

Link to comment
Share on other sites

Thanks lee. Will try when back in office tomorrow.

 

But just to highlight I actually do need one base on selection after all.

 

I will try the one that you have suggested first.

 

Thanks.

Link to comment
Share on other sites

  • 4 months later...

Hi LEE,

 

I have now encounter situations where I need to base on selections instead of the whole drawings.

 

Could you incorporate a selection options (window & picking) for the LISP?

 

Thanks

Link to comment
Share on other sites

Hi LEE,

 

I have now encounter situations where I need to base on selections instead of the whole drawings.

 

Could you incorporate a selection options (window & picking) for the LISP?

 

Thanks

 

Thanks but not suitable for my work situation. ;)

Link to comment
Share on other sites

Are you trying to get the linetypes inside a block to display correctly?

 

More specific is the linetype scale so that the dash line can be consistent throughout the whole drawing. LEE 's lisp is great & go many levels of nested blocks. But it will affect the whole drawing which due to a my new nature is work require a selecting specifi blocks only.

Link to comment
Share on other sites

More specific is the linetype scale so that the dash line can be consistent throughout the whole drawing. LEE 's lisp is great & go many levels of nested blocks. But it will affect the whole drawing which due to a my new nature is work require a selecting specifi blocks only.

 

Linetypes inside blocks are problematic, they are affected by the scale they were inserted as well as changes in linetype scale. Easiest solution I've found is to use the LinExp.lsp downloaded from http://www.cadstudio.cz/en/download.asp?file=LinExp

Edit the block and with the linetype scale adjusted to look the way you want explode them into dashes & dots. Once saved the block linetypes will display the same dashes & dots no matter the insertion scale or linetype scale.

Link to comment
Share on other sites

Linetypes inside blocks are problematic, they are affected by the scale they were inserted as well as changes in linetype scale. Easiest solution I've found is to use the LinExp.lsp downloaded from http://www.cadstudio.cz/en/download.asp?file=LinExp

Edit the block and with the linetype scale adjusted to look the way you want explode them into dashes & dots. Once saved the block linetypes will display the same dashes & dots no matter the insertion scale or linetype scale.

Yes, they are extremely problematic. Previously I spend hours going in many levels of nested blocks to manually change the lines type scale. I totally gave up.

 

LEE's lisp ultimately saved me hours not to mention my sanity.

 

Thanks for your suggestion But I need to retain my original lines & not break them into bits.

Edited by vernonlee
Link to comment
Share on other sites

  • 1 year later...

1. LISP that can change hatch scale of a specific hatch in block (ex. ar-concrete)

 

2.LISP that can merge linetype (ex.from 111111111$0$hidden to hidden)

Link to comment
Share on other sites

  • 4 years later...
On 3/10/2015 at 5:45 AM, Lee Mac said:

 

Try the following:

 


(defun c:lts ( / doc scl )
   (initget 6)
   (if (setq scl (getreal "\nSpecify new linetype scale: "))
       (vlax-for blk (vla-get-blocks (setq doc (vla-get-activedocument (vlax-get-acad-object))))
           (if (= :vlax-false (vla-get-isxref blk))
               (vlax-for obj blk
                   (if (and (vlax-write-enabled-p obj) (vlax-property-available-p obj 'linetypescale t))
                       (vla-put-linetypescale obj scl)
                   )
               )
           )
       )
   )
   (vla-regen doc acallviewports)
   (princ)
)
 

 

 

Thank you! This saved me a tremendous amount of work!

Link to comment
Share on other sites

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...