<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512536#M57513</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Please see my responses below, in blue font.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Are there any affected entities inside blocks? Also other spaces than current?&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;How about the current state of layers - are any frozen or locked? What if they do, ignore them? or process them too?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#0000FF"&gt;All objects are in model space for these drawings&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#0000FF"&gt;Updating block elements would be a priority for me, but frozen or locked layers could be ignored if it gets too complicated. I've been struggling to understand how to write a basic function to investigate the entities inside of blocks, so I'm willing to sacrifice it for the lisp since I can't do it. I am working with a lot of drawing conversions between AutoCAD DWG and Microstation DGN, and for DWG files being converted to DGN, the current process is to explode the blocks to avoid certain conversion issues. However, if you would be willing to show me how to include updating entities in blocks, I would be so very grateful!&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Also, your wording is still unclear to me.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;It's clear, that if an object has assigned one of those ltypes, the ltypes would be updated and so it's ltscale to 1.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;But if talking layers w/ lt - am I right thinking that we need update ltscale to 1 only to those objects w/ lt bylayer? The question is whether there is the possibility that some objects in those layers have assigned different ltype with different ltscale.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;My apologies, hopefully I can explain the obect ltScale issue better below.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;So in Step 4 (the final step), I would like to reset the ltscale of all the linetypes in the drawing that are newly defined as LTYP100, LTYP200... to LTYP700. This will apply to all objects with &lt;STRONG&gt;&lt;U&gt;only&lt;/U&gt; &lt;/STRONG&gt;these linetypes I defined, whether assigned as a ByLayer override, or by object property. Does this make sense?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;A lot of the drawings I'm reviewing are on layers with a linetype override (e.g. ByLayer set to "LTYP100"), but objects on those layers could either be set to ByLayer or different linetypes.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;So, I could have a layer defined with ltype as "LTYP100", and there could be objects on that layer with multiple linetypes. It's admittedly a mess, and not how I personally would do the drafting but seemingly a legacy issue from old Microstation files with limited layers available. These drawings may be converted back to DGN anyhow.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;btw I have your original reply in my mailbox. It probably fell to the site's spam filter. You could ask the moderator to get it back (and wait until tomorrow).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Understood, thanks for letting me know. Again, your help is very much appreciated!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Aug 2021 19:11:50 GMT</pubDate>
    <dc:creator>billdunham3068</dc:creator>
    <dc:date>2021-08-01T19:11:50Z</dc:date>
    <item>
      <title>Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10511748#M57508</link>
      <description>&lt;P&gt;I am trying to write a lisp to complete the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Select objects where the linetype is set BYLAYER, with a specific linetype (e.g. "CENTER")&lt;/LI&gt;&lt;LI&gt;Change/update the LTSCALE of those specific objects (e.g. make them 1.0)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I found it was quite easy for me to select all objects with a specific linetype by object and update the properties. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(setq ss (ssget "X" '((6 . "CENTER"))))&lt;BR /&gt;(if (/= ss nil)&lt;BR /&gt;(progn&lt;BR /&gt;(command "chprop" ss "" "ltype" "CENTER2" "")&lt;BR /&gt;(command "chprop" ss "" "ltscale" "1" "")&lt;BR /&gt;); progn&lt;BR /&gt;(prompt "\nCENTER linetype not found\n")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can update all linetypes set to BYLAYER to using the following code, but it doesn't update the LTSCALE as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))&lt;BR /&gt;(if (= "CENTER" (vla-get-linetype layer))(vla-put-Linetype layer "CENTER2")))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd like to be able to modify the code above to both update the Linetype and the LtScale of the affected objects. I'm admittedly not very skilled with programming and writing lisps, but I've managed to get by following the many examples and generous assistance offered to others with similar queries on these forums. I would really appreciate any help to both understand and complete the code, just something simple that I can follow with my limited knowledge.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 07:11:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10511748#M57508</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-01T07:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10511895#M57509</link>
      <description>&lt;P&gt;Not sure if this is what you want... try and see. I wrote 2 versions... read the comments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:LTCenter1 ( / s i e l)

  (if (setq s (ssget "_A" (list '(6 . "CENTER") (cons 410 (getvar 'ctab)))))
    (command "_.chprop" s "" "_ltype" "CENTER2" "ltscale" 1 ""))

  (if (and (setq s (ssget "_A" (list '(6 . "BYLAYER") (cons 410 (getvar 'ctab)))))
	   (vl-cmdf "_.chprop" s "" "ltscale" 1 "")) ; change LTScale of each object
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i)))
	    l (cdr (assoc 8 (entget e))))
      (if (= "CENTER" (cdr (assoc 6 (tblsearch "LAYER" l))))
	(command "_.-layer" "ltype" "CENTER2" l "")))) ; change layer's linetype

  (princ)
  )

(defun c:LTCenter2 ( / s i e)

  (if (setq s (ssget "_A" (list '(6 . "CENTER") (cons 410 (getvar 'ctab))))) 
    (command "_.chprop" s "" "_ltype" "CENTER2" "ltscale" 1 ""))

  (if (setq s (ssget "_A" (list '(6 . "BYLAYER") (cons 410 (getvar 'ctab)))))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (if (not (= "CENTER" (cdr (assoc 6 (tblsearch "LAYER" (cdr (assoc 8 (entget e)))))))) 
	(ssdel e s))))

  (if (and s (&amp;gt; (sslength s) 0))
    (command "_.chprop" s "" "_ltype" "CENTER2" "ltscale" 1 ""))  ; change just object's properties ltscale and linetype. the won't change a layer property.

  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV id="gtx-trans" style="position: absolute; left: 259px; top: 96.4403px;"&gt;
&lt;DIV class="gtx-trans-icon"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Sun, 01 Aug 2021 09:38:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10511895#M57509</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-01T09:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512441#M57511</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for the quick reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I posted a lengthy response a short while ago, and to my horror it seemingly vanished. I'm assuming you never saw it, so I will try and re-type it all...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your functions work perfectly to do what I outlined. I realize now that I probably should've provided more details in my original post but because of my limited lisp knowledge and not wanting to make it more confusing, I was hoping I could try and learn by example and expand it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please review the full scope of what I'm trying to do? I'd really appreciate your help.&lt;/P&gt;&lt;P&gt;The ultimate goal is to be able to update a series of linetypes. For simplicity, please see the table below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LTYP1 -&amp;gt; change to LTYP100&lt;BR /&gt;LTYP2 -&amp;gt; change to LTYP200&lt;BR /&gt;LTYP3 -&amp;gt; change to LTYP300&lt;BR /&gt;LTYP4 -&amp;gt; change to LTYP400&lt;BR /&gt;LTYP5 -&amp;gt; change to LTYP500&lt;BR /&gt;LTYP6 -&amp;gt; change to LTYP600&lt;BR /&gt;LTYP7 -&amp;gt; change to LTYP700&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In reality, I realize the last step would be updating setting the ltscale to 1 for all of the new LTYP "X00" linetypes. This is because the new linetypes I've created are defined at 1:1 scale, where the old ones had various ltscales applied. I don't want to update any other linetype scales in the drawing, such as other standard or custom linetypes that may exist, since they may need to retain their own properties to plot properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I had so far, mixed with my comments/questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun C:UPDATELTYP ()


(initget "Y N")
(setq option (getkword "\nThis function will update all LTYP "X" Linetypes in the drawing.\nDo you wish to continue? [Y/N] &amp;lt;N&amp;gt;: ")) 

(if (= option "Y")


(progn

   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
   ; STEP 1: load the new linetypes if they are not found in the drawing
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;   
   (foreach lt '("LTYP100" "LTYP200" "LTYP300" "LTYP400" "LTYP500" "LTYP600" "LTYP700")
      (if (not (tblsearch "ltype" lt))(command "_.-linetype" "_l" lt "LTYP.lin" ""))) 


   (vl-load-com)


   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
   ; STEP 2: on my own, I only know how to use the code below, for updating 
   ; the layer linetypes one at a time:
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
   (vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))
      (if (= "LTYP1" (vla-get-linetype layer))(vla-put-Linetype layer "LTYP100")))
   ; I would repeat the code above for each affected linetype by layer. 
   ; I would prefer a list/array!

 
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
   ; STEP 3: for linetypes set by object property, I can use SSGET but I 
   ; don't know how to make it work within a loop
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
   (setq ss (ssget "X" '((6 . "LTYP1"))))
   (if (/= ss nil)
       (progn 
           (command "_.chprop" ss "" "_ltype" "LTYP100" "")
       ); progn
       (prompt "\nLTYP1 not found\n")
   ); if


   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
   ; STEP 4: the last step would be to update the ltscale of only the 
   ; updated linetypes defined above. Again, I know how to use SSGET for 
   ; selecting object by linetype one at a time, but not in a loop for all,
   ; and FOREACH won't work.
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 


(prompt "\nLTYP Linetype Conversion Complete!")

); progn

(prompt "\nLTYP Linetype Conversion: *CANCELLED*")

); if

(princ)

); defun&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;r&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 17:45:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512441#M57511</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-01T17:45:19Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512498#M57512</link>
      <description>&lt;P&gt;Are there any affected entities inside blocks? Also other spaces than current?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How about the current state of layers - are any frozen or locked? What if they do, ignore them? or process them too?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, your wording is still unclear to me.&lt;/P&gt;
&lt;P&gt;It's clear, that if an object has assigned one of those ltypes, the ltypes would be updated and so it's ltscale to 1.&lt;/P&gt;
&lt;P&gt;But if talking layers w/ lt - am I right thinking that we need update ltscale to 1 only to those objects w/ lt bylayer? The question is whether there is the possibility that some objects in those layers have assigned different ltype with different ltscale.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw I have your original reply in my mailbox. It probably fell to the site's spam filter. You could ask the moderator to get it back (and wait until tomorrow).&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 18:40:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512498#M57512</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-01T18:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512536#M57513</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Please see my responses below, in blue font.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Are there any affected entities inside blocks? Also other spaces than current?&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;How about the current state of layers - are any frozen or locked? What if they do, ignore them? or process them too?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT color="#0000FF"&gt;All objects are in model space for these drawings&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT color="#0000FF"&gt;Updating block elements would be a priority for me, but frozen or locked layers could be ignored if it gets too complicated. I've been struggling to understand how to write a basic function to investigate the entities inside of blocks, so I'm willing to sacrifice it for the lisp since I can't do it. I am working with a lot of drawing conversions between AutoCAD DWG and Microstation DGN, and for DWG files being converted to DGN, the current process is to explode the blocks to avoid certain conversion issues. However, if you would be willing to show me how to include updating entities in blocks, I would be so very grateful!&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Also, your wording is still unclear to me.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;It's clear, that if an object has assigned one of those ltypes, the ltypes would be updated and so it's ltscale to 1.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;But if talking layers w/ lt - am I right thinking that we need update ltscale to 1 only to those objects w/ lt bylayer? The question is whether there is the possibility that some objects in those layers have assigned different ltype with different ltscale.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;My apologies, hopefully I can explain the obect ltScale issue better below.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;So in Step 4 (the final step), I would like to reset the ltscale of all the linetypes in the drawing that are newly defined as LTYP100, LTYP200... to LTYP700. This will apply to all objects with &lt;STRONG&gt;&lt;U&gt;only&lt;/U&gt; &lt;/STRONG&gt;these linetypes I defined, whether assigned as a ByLayer override, or by object property. Does this make sense?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;A lot of the drawings I'm reviewing are on layers with a linetype override (e.g. ByLayer set to "LTYP100"), but objects on those layers could either be set to ByLayer or different linetypes.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;So, I could have a layer defined with ltype as "LTYP100", and there could be objects on that layer with multiple linetypes. It's admittedly a mess, and not how I personally would do the drafting but seemingly a legacy issue from old Microstation files with limited layers available. These drawings may be converted back to DGN anyhow.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;btw I have your original reply in my mailbox. It probably fell to the site's spam filter. You could ask the moderator to get it back (and wait until tomorrow).&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Understood, thanks for letting me know. Again, your help is very much appreciated!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 19:11:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512536#M57513</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-01T19:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512709#M57514</link>
      <description>&lt;P&gt;Here's the quick one. If any issues, post a test drawing and I'll take a look tomorrow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;
(vl-load-com)
;; beekeecz 21-08-01

(defun c:LtTranslate (/ *error* acdoc lst lto ltn s i e o lt lys)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
      (princ (strcat "\nError: " errmsg)))
    (vla-endundomark acdoc)
    (princ))
  
  (if (not acdoc) (setq acdoc (vla-get-activedocument (vlax-get-acad-object))))
  (vla-startundomark acdoc)
  
  (setq lst '(("BORDER" . "BORDER2") ; case-sensitive!
	      ("CENTER" . "CENTER2")
	      ("LTYP3" . "LTYP300")
	      ("LTYP4" . "LTYP400")
	      ("LTYP5" . "LTYP500")
	      ("LTYP6" . "LTYP600")
	      ("LTYP7" . "LTYP700"))
	lto (mapcar 'car lst)
	ltn (mapcar 'cdr lst))
  
  (if (or (findfile "ltyp.lin")
	  (prompt "\nError: ltyp.lin not found!"))
    (foreach lt ltn
      (if (not (tblsearch "ltype" lt)) (progn (getvar 'cmdecho 0) (command "_.-linetype" "_l" lt "LTYP.lin" "") (getvar 'cmdecho 1)))))
  
  (if (vl-position (getvar 'celtype) lto)
    (setvar 'celtype "ByLayer"))
  
  (vlax-for layer (vla-get-layers acdoc)
    (if (vl-position (setq lt (vla-get-linetype layer)) lto)
      (progn
	(vla-put-Linetype layer (cdr (assoc lt lst)))
	(setq lys (cons (vla-get-name layer) lys)))))
  
  (if (setq s (ssget "_X"))
    (repeat (setq i (sslength s))
      (setq e (ssname s (setq i (1- i))))
      (if (setq lt (cdr (assoc 6 (entget e))))
	(if (vl-position lt lto)
	  (progn
	    (vla-put-linetype (setq o (vlax-ename-&amp;gt;vla-object e)) (cdr (assoc lt lst)))
	    (vla-put-linetypescale o 1.)))
	(if (vl-position (cdr (assoc 8 (entget e))) lys)
	  (vla-put-linetypescale o 1.)))))
  
  (vlax-for blk (vla-get-blocks acdoc)
    (if (and (equal (vla-get-islayout blk) :vlax-false)
	     (equal (vla-get-isxref blk) :vlax-false)
	     )
      (vlax-for o blk
	(if (vl-position (setq lt (vla-get-linetype o)) lto)
	  (progn
	    (vl-catch-all-apply 'vla-put-linetype (list o (cdr (assoc lt lst))))
	    (vl-catch-all-apply 'vla-put-linetypescale (list o 1.))))
	(if (and (= (vla-get-linetype o) "ByLayer")
		 (vl-position (vla-get-layer o) lys))
	  (vl-catch-all-apply 'vla-put-linetypescale (list o 1.))))))
  
  (command "_.-PURGE" "_lt" (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) lto)) "_n")
  
  (vla-regen acdoc AcallViewports)
  (vla-endundomark acdoc)
  (princ)
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 22:18:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512709#M57514</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-01T22:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512789#M57515</link>
      <description>&lt;P&gt;&lt;FONT color="#0000FF"&gt;Thank you!!&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I ran your code, but in my tests it wasn't updating the linetype scale where the linetypes were assigned BYLAYER.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Could you please take a look at this test drawing, and let me know?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Your code is very effecient and easy for me to follow, this is a great learning experience for me. There is so much to learn about programming lisps...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;The existing linetypes I'm going to change in this test file are the default Microstation DGN Styles (1 through 7) that are exported to DWG. I modified the 'lst' to indicate these linetypes. Please see the change required below.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;  (setq lst '(("DGN Style 1" . "LTYP100") ; case-sensitive!
	      ("DGN Style 2" . "LTYP200")
	      ("DGN Style 3" . "LTYP300")
	      ("DGN Style 4" . "LTYP400")
	      ("DGN Style 5" . "LTYP500")
	      ("DGN Style 6" . "LTYP600")
	      ("DGN Style 7" . "LTYP700"))
	lto (mapcar 'car lst)
	ltn (mapcar 'cdr lst))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 23:39:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10512789#M57515</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-01T23:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10513399#M57516</link>
      <description>&lt;P&gt;Ok, thanks for the dwg. Now it seems to be working fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(vl-load-com)
;; beekeecz 21-08-01

(defun c:UpdateLtyp (/ *error* cmd stl acdoc :main-set-function :LayersAllUnlockAndThaw :LayersRestore lst lto ltn s i e o lt lys)

  ;-----
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if cmd (setvar 'cmdecho cmd))
    (if stl (:LayersRestore stl))
    (vla-endundomark acdoc)
    (vla-regen acdoc AcallViewports)
    (princ))
  
  ;-----
  (defun :main-set-function (o)
    (if (= (setq lt (vla-get-linetype o)) "ByLayer")
      (if (vl-position (vla-get-layer o) lys)
	(vl-catch-all-apply 'vla-put-linetypescale (list o 1.)))
      (if (vl-position lt (append lto ltn))
	(progn
	  (vl-catch-all-apply 'vla-put-linetype (list o (cdr (assoc lt lst))))
	  (vl-catch-all-apply 'vla-put-linetypescale (list o 1.))))))
  
  ;-----
  (defun :LayersAllUnlockAndThaw (doc / lst)
    (vlax-for itm (vla-get-layers doc)
      (setq lst (cons (list itm
			    (cons "lock" (vla-get-lock itm))
			    (cons "freeze" (vla-get-freeze itm)))
		      lst))
      (vla-put-lock itm :vlax-false)
      (vl-catch-all-apply '(lambda () (vla-put-freeze itm :vlax-false))))
    lst)
  
  ;-----
  (defun :LayersRestore (lst)
    (foreach itm lst
      (vla-put-lock (car itm) (cdr (assoc "lock" (cdr itm))))
      (vl-catch-all-apply '(lambda () (vla-put-freeze (car itm) (cdr (assoc "freeze" (cdr itm))))))))
  
  ; -------------------------------------------------------------------------------------------------
  
  (or acdoc (setq acdoc (vla-get-activedocument (vlax-get-acad-object))))
  (vla-startundomark acdoc)
  
  (setq lst 				; case-sensitive!
	 '(("DGN Style 1" . "LTYP100")
	   ("DGN Style 2" . "LTYP200")
	   ("DGN Style 3" . "LTYP300")
	   ("DGN Style 4" . "LTYP400")
	   ("DGN Style 5" . "LTYP500")
	   ("DGN Style 6" . "LTYP600")
	   ("DGN Style 7" . "LTYP700"))
	)
  
  (setq lto (mapcar 'car lst)
	ltn (mapcar 'cdr lst))
  
  (setq cmd (getvar 'cmdecho)) (setvar 'cmdecho 0)
  (setq stl (:LayersAllUnlockAndThaw acdoc))
  
  (if (or (findfile "ltyp.lin")
	  (prompt "\nError: 'ltyp.lin' file not found!"))
    (foreach lt ltn
      (if (not (tblsearch "ltype" lt)) (command "_.-linetype" "_l" lt "LTYP.lin" ""))))
  
  (vlax-for layer (vla-get-layers acdoc)
    (if (vl-position (setq lt (vla-get-linetype layer)) lto)
      (progn
	(vla-put-Linetype layer (cdr (assoc lt lst)))
	(setq lys (cons (vla-get-name layer) lys)))))
  
  (if (setq s (ssget "_X"))
    (repeat (setq i (sslength s))
      (:main-set-function (vlax-ename-&amp;gt;vla-object (ssname s (setq i (1- i)))))))
  
  (vlax-for blk (vla-get-blocks acdoc)
    (if (and (equal (vla-get-islayout blk) :vlax-false)
	     (equal (vla-get-isxref blk) :vlax-false)
	     )
      (vlax-for o blk
	(:main-set-function o))))
  
  (if (vl-position (getvar 'celtype) lto) (setvar 'celtype "ByLayer"))
  (command "_.-PURGE" "_lt" (apply 'strcat (mapcar '(lambda (x) (strcat x ",")) lto)) "_n")
  (*error* "end")
  )
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 08:04:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10513399#M57516</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-02T08:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10514513#M57517</link>
      <description>&lt;P&gt;Wow, this is absolutely brilliant - thank you so much!!!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":man_dancing:"&gt;🕺&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":man_dancing:"&gt;🕺&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":man_dancing:"&gt;🕺&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will mark this as resolved. I &lt;EM&gt;&lt;STRONG&gt;really&lt;/STRONG&gt; &lt;/EM&gt;appreciate your time and effort to help me with this, and to generate and share such a complete and elegant solution. I wouldn't have been surprised if someone else had told me to "come back and post after I passed LISP 101".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;btw, I added a Yes/No prompt at the very beginning of your code. I don't know if it's really necessary but I usually include it in my basic functions, just in case I change my mind and want to cancel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;  ;;;;;;
  (initget "Y N")
  (setq option (getkword "\nThis function will update all the old DGN Styles (1 to 7)
     with redfined linetypes.\nDo you wish to continue? [Y/N] &amp;lt;N&amp;gt;: ")) 

  (if (= option "N")(quit))
  ;;;;;;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 16:01:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10514513#M57517</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-02T16:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10514865#M57518</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/11165597"&gt;@billdunham3068&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;... btw, I added a Yes/No prompt at the very beginning of your code. I don't know if it's really necessary but I usually include it in my basic functions, just in case I change my mind and want to cancel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="lisp"&gt;  ;;;;;;
  (initget "Y N")
  (setq option (getkword "\nThis function will update all the old DGN Styles (1 to 7)
     with redfined linetypes.\nDo you wish to continue? [Y/N] &amp;lt;N&amp;gt;: ")) 

  (if (= option "N")(quit))
  ;;;;;;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This will not work for the &amp;lt;N&amp;gt; enter option.&amp;nbsp; You need to have (if (/= option "Y") (quit))...&lt;/P&gt;
&lt;P&gt;But personally, I would flip the option to &amp;lt;Yes&amp;gt; under &amp;lt;enter&amp;gt; key.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 18:28:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10514865#M57518</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2021-08-02T18:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp: Select objects w/ Linetype BYLAYER, change LTSCALE</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10515867#M57519</link>
      <description>&lt;P&gt;I updated the Yes/No prompt, thanks again for your feedback&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 05:24:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-select-objects-w-linetype-bylayer-change-ltscale/m-p/10515867#M57519</guid>
      <dc:creator>billdunham3068</dc:creator>
      <dc:date>2021-08-03T05:24:14Z</dc:date>
    </item>
  </channel>
</rss>

