Jump to content

Recommended Posts

Posted (edited)

Hi All,

 

I just moved from AutoCAD 2023 to AutoCAD 2027.

 

 

My script that reloads some linetypes seems to fail in this version.

Afer soms manual testing, i noticed that the 'reload linetype' function looks totaly broken?

 

Anybody else can confirm this?

 

EDIT:

 

After some more research, it seems like... when i got a linetype with a shape in it. and reload the linetype without the Shape. AutoCAD is still showing the SHAPE, like the removal of shapes isnt handled properly

Edited by Aftertouch
Posted

I don't have AutoCAD 2027, but it may show up in AutoCAD 2026. I will do some checking when I get back to work next week.

 

You should post your script and your shape linetypes that are an issue.

 

You could see if a LISP works for you Lee Mac has one... https://lee-mac.com/loadlinetype.html.

 

Here is an example of using loadlinetype.lsp in a Macro... 

 

You may want to contact Autodesk, they may know about the issue or at least would need to know.

  • Like 1
Posted

Just a maybe reload the shx while you sort out what is going on. Are your shx files and custom .lin files in a support path ? That may be why they are not reloading.

 

(command "._LOAD" "C:\\Path\\To\\YourFile\\custom.shx")

or

(command "._LOAD" "Custom.shx") ; tested this Bricscad V25

 

Posted
On 7/1/2026 at 8:15 AM, Aftertouch said:

Hi All,

After some more research, it seems like... when i got a linetype with a shape in it. and reload the linetype without the Shape. AutoCAD is still showing the SHAPE, like the removal of shapes isn't handled properly

Did you regen the drawing?

Shapes are referenced by linetypes not defined by them. Whatever Shapes defined in the drawing would still be there.

Did you remove the Shape references in the linetype definition before reloading it?

  • Like 1
Posted (edited)

 

Hi All, thanks for the replies.

 

@tombu

That is exactly the issue.

I removed the SHAPE reference from the linetype, reload the linetype. I see that the linetype is changed a bit, but the SHAPE keeps being shown.

Even when i check the linetype definition in the DWG, the SHPAE reference is gone there, but still visualy there.

 

Look, there are my definitions:

image.thumb.png.6b90dc3a19a95c52b8b17e6c4799e291.png

 

Video attatched with my relaoding action.

 

when i load the WITHOUT.LIN in a NEW drawing. the linetype is just fine...

In the last sec off the video i do a REA command, and you see the linetype presentation change a bit.

 

Most anoying... in AutoCAD 2023 this works just fine... looks like an AutoCAD 2027 error.

Edited by Aftertouch
  • Thanks 1
Posted

Have you tried saving, closing and reopening the drawing?

I retired a few years ago and never saw the latest version.

Here's a link to a lisp that will output the linetype definition of a selected line to the command line.

I wrote it to extract linetypes I liked from drawings by others to add to my acad.lin file: https://forums.autodesk.com/t5/autocad-forum/export-linetype-to-acad-lin/m-p/11945136#M36909 which is why I called it LT_thief.lsp

It will output the actual current linetype definition of a selected line to the command line including the shape references.

  • Thanks 1
Posted

@tombu

 

Ive had contact with AutoDesk:

 

Hello Michel,

I am writing to confirm that I have reviewed the issue you reported and replicated the results you described (see this video:https://go.screenpal.com/watch/cOieX2nU2gH ). I want to assure you that we've reported it to our development team, and they're currently investigating it.

The resulting internal development ticket is linked to this technical support case and has the following Issue ID/subject: "CPR-2262 Reloading complex linetype without SHX shape does not update line display".

 

AutoCAD confirmed that this issue is present since AutoCAD 2025 version. 🙂

  • Like 1
  • Thanks 1
Posted

Did the reload shx work ? It may take some time for a bug fix.

  • Like 1
Posted

@Aftertouch I thought this may be a bug. I think there may be other bugs since 2025 version, I had some issues last year with linetypes.

 

I'll play around with it next week when I am at work and have AutoCAD 2026 to test.

 

@tombu I have the other one in that thread from Cad Studio, I'll have to try yours out when I get to work next week.

Posted

I got myself a workaround that seems to work for me.

 

Made a LISP (long live AI) that stores all layer and linetype combinations.

Sets everything to 'Continious', purges all linetypes, that reloads the linetypes and that restores the default settings.

 

This seems to do the trick to get rid off all 'corrupted' linetype definitions, and 'reloading' is replaced with a load function.

  • Like 1
Posted

I can't remember what I ended up doing. My issue was very similar and involved linetypes with shape files.

 

Please post back here if Autodesk resolves the issue.

 

  • 2 weeks later...
Posted

Any follow up from Autodesk?

 

I am about to start working on some linetypes, some with shapes.

 

I'll see about an upgrade to 2027 and hopefully they put out a fix for this.

Posted (edited)

@SLW210 Autodesk is going to fix this issue in a 'future update'.

 

I made this LISP, as a custom linetype reloader that DOES work. RELOADELINETYPE is the commando:

 

NOTE: This only works when ALL entities are drawn 'ByLayer', and all is configured with the layermanager.

 

;;; ------------------------------------------------------------------------
;;; RELOADLINETYPE.lsp
;;;
;;; AutoCAD 2027 workaround voor defecte "Reload all linetypes"-logica.
;;;
;;; Commando:
;;;   RELOADLINETYPE
;;;
;;; Werking:
;;;   1. Selecteer een .LIN-bestand.
;;;   2. Lees alle linetype-namen uit het .LIN-bestand.
;;;   3. Zoek layers in de DWG die deze linetypes gebruiken.
;;;   4. Zet deze layers tijdelijk op Continuous.
;;;   5. Voer zichtbaar -PURGE uit op linetypes.
;;;   6. Laad het gekozen .LIN-bestand opnieuw.
;;;   7. Herstel de layer-linetypes.
;;;   8. REGENALL.
;;;
;;; Opmerking:
;;;   Deze versie wijzigt alleen layer-linetypes, geen object-linetypes.
;;; ------------------------------------------------------------------------

(defun GPAE:RL-STR-TRIM (s)
  (if s
    (vl-string-trim " \t\r\n" s)
    ""
  )
)

(defun GPAE:RL-CI-MEMBER (val lst / uval found item)
  (setq found nil)
  (if val
    (progn
      (setq uval (strcase val))
      (foreach item lst
        (if (= uval (strcase item))
          (setq found T)
        )
      )
    )
  )
  found
)

(defun GPAE:RL-UNIQUE-CI (lst / result item)
  (setq result '())
  (foreach item lst
    (if (not (GPAE:RL-CI-MEMBER item result))
      (setq result (cons item result))
    )
  )
  (reverse result)
)

(defun GPAE:RL-READ-LINETYPE-NAMES-FROM-LIN (linFile / fh line clean commaPos name names firstChar)
  (setq names '())

  (if (setq fh (open linFile "r"))
    (progn
      (while (setq line (read-line fh))
        (setq clean (GPAE:RL-STR-TRIM line))

        ;; Linetype-definitieregels beginnen met:
        ;; *NAAM,omschrijving
        ;;
        ;; Voorbeeld:
        ;; *DASHED,Dashed __ __ __ __ __
        (if (> (strlen clean) 1)
          (progn
            (setq firstChar (substr clean 1 1))
            (if (= firstChar "*")
              (progn
                (setq commaPos (vl-string-search "," clean))
                (if commaPos
                  (progn
                    ;; vl-string-search is 0-based.
                    ;; Bij "*ABC," geeft commaPos 4 terug.
                    ;; substr is 1-based en lengte 3 geeft "ABC".
                    (setq name (substr clean 2 (- commaPos 1)))
                    (setq name (GPAE:RL-STR-TRIM name))
                    (if (> (strlen name) 0)
                      (setq names (cons name names))
                    )
                  )
                )
              )
            )
          )
        )
      )
      (close fh)
    )
  )

  (GPAE:RL-UNIQUE-CI names)
)

(defun GPAE:RL-COLLECT-LAYERS-WITH-LINETYPES (doc ltNames / layers lay layerName layerLt result)
  (setq result '())
  (setq layers (vla-get-Layers doc))

  (vlax-for lay layers
    (setq layerName (vla-get-Name lay))
    (setq layerLt (vla-get-Linetype lay))

    (if
      (and
        layerLt
        (/= (strcase layerLt) "CONTINUOUS")
        (GPAE:RL-CI-MEMBER layerLt ltNames)
      )
      (setq result (cons (list layerName layerLt) result))
    )
  )

  (reverse result)
)

(defun GPAE:RL-SET-LAYERS-CONTINUOUS (doc layerData / layers item layerName layObj)
  (setq layers (vla-get-Layers doc))

  (foreach item layerData
    (setq layerName (car item))

    (vl-catch-all-apply
      '(lambda ()
         (setq layObj (vla-item layers layerName))
         (vla-put-Linetype layObj "Continuous")
       )
    )
  )
)

(defun GPAE:RL-RESTORE-LAYER-LINETYPES (doc layerData / layers item layerName oldLt layObj failed)
  (setq layers (vla-get-Layers doc))
  (setq failed '())

  (foreach item layerData
    (setq layerName (car item))
    (setq oldLt (cadr item))

    (if
      (vl-catch-all-error-p
        (vl-catch-all-apply
          '(lambda ()
             (setq layObj (vla-item layers layerName))
             (vla-put-Linetype layObj oldLt)
           )
        )
      )
      (setq failed (cons (strcat layerName " -> " oldLt) failed))
    )
  )

  (reverse failed)
)

(defun GPAE:RL-REPORT-LINETYPES (ltNames / txt name count maxCount)
  (setq txt "")
  (setq count 0)
  (setq maxCount 25)

  (foreach name ltNames
    (if (< count maxCount)
      (setq txt (strcat txt name "\n"))
    )
    (setq count (1+ count))
  )

  (if (> (length ltNames) maxCount)
    (setq txt
      (strcat
        txt
        "... en nog "
        (itoa (- (length ltNames) maxCount))
        " meer.\n"
      )
    )
  )

  txt
)

(defun C:RELOADLINETYPE
  (
    /
    *error*
    doc
    oldExpert
    oldCmdecho
    oldCeltype
    oldClayer
    linFile
    ltNames
    layerData
    restoreFailed
  )

  (vl-load-com)

  (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))

  (setq oldExpert (getvar "EXPERT"))
  (setq oldCmdecho (getvar "CMDECHO"))
  (setq oldCeltype (getvar "CELTYPE"))
  (setq oldClayer (getvar "CLAYER"))

  (defun *error* (msg)
    (if oldCeltype
      (vl-catch-all-apply 'setvar (list "CELTYPE" oldCeltype))
    )
    (if oldExpert
      (vl-catch-all-apply 'setvar (list "EXPERT" oldExpert))
    )
    (if oldCmdecho
      (vl-catch-all-apply 'setvar (list "CMDECHO" oldCmdecho))
    )
    (if oldClayer
      (vl-catch-all-apply 'setvar (list "CLAYER" oldClayer))
    )

    (vl-catch-all-apply 'vla-EndUndoMark (list doc))

    (if
      (and
        msg
        (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*"))
      )
      (alert (strcat "Fout in RELOADLINETYPE:\n\n" msg))
    )

    (princ)
  )

  (setq linFile
    (getfiled
      "Selecteer LIN-bestand om opnieuw te laden"
      ""
      "lin"
      0
    )
  )

  (if (not linFile)
    (progn
      (princ "\nGeen LIN-bestand geselecteerd.")
      (princ)
      (exit)
    )
  )

  (if (not (findfile linFile))
    (progn
      (alert (strcat "LIN-bestand niet gevonden:\n\n" linFile))
      (princ)
      (exit)
    )
  )

  (setq ltNames (GPAE:RL-READ-LINETYPE-NAMES-FROM-LIN linFile))

  (if (not ltNames)
    (progn
      (alert
        (strcat
          "Geen linetype-definities gevonden in:\n\n"
          linFile
          "\n\nControleer of het bestand regels bevat zoals:\n*LIJNTYPENAAM,omschrijving"
        )
      )
      (princ)
      (exit)
    )
  )

  (vla-StartUndoMark doc)

  ;; CMDECHO bewust aan, zodat -PURGE in de commandline zichtbaar is.
  (setvar "CMDECHO" 1)
  (setvar "EXPERT" 5)
  (setvar "CELTYPE" "Continuous")

  (princ "\n---------------------------------------------")
  (princ "\nRELOADLINETYPE gestart")
  (princ (strcat "\nLIN-bestand: " linFile))
  (princ (strcat "\nAantal linetypes gevonden in LIN: " (itoa (length ltNames))))
  (princ "\nGevonden linetypes:")
  (foreach linName ltNames
    (princ (strcat "\n - " linName))
  )

  (setq layerData (GPAE:RL-COLLECT-LAYERS-WITH-LINETYPES doc ltNames))

  (princ (strcat "\nAantal layers tijdelijk naar Continuous: " (itoa (length layerData))))

  (if layerData
    (progn
      (princ "\nLayers tijdelijk op Continuous zetten...")
      (GPAE:RL-SET-LAYERS-CONTINUOUS doc layerData)
    )
    (princ "\nGeen layers gevonden die deze linetypes gebruiken.")
  )

  (princ "\nLinetypes purgen via AutoCAD commandline...")
  (princ "\nUitgevoerd: -PURGE > LT > * > N")

  ;; Echt AutoCAD purge-commando, zichtbaar in commandline.
  (command "_.-PURGE" "_LT" "*" "_N")

  (princ "\nLIN-bestand opnieuw laden...")
  (command "_.-LINETYPE" "_LOAD" "*" linFile "")

  (princ "\nLayer-linetypes herstellen...")
  (setq restoreFailed (GPAE:RL-RESTORE-LAYER-LINETYPES doc layerData))

  (setvar "CELTYPE" oldCeltype)
  (setvar "EXPERT" oldExpert)
  (setvar "CMDECHO" oldCmdecho)
  (setvar "CLAYER" oldClayer)

  (command "_.REGENALL")

  (vla-EndUndoMark doc)

  (princ "\n---------------------------------------------")
  (princ "\nRELOADLINETYPE voltooid.")
  (princ (strcat "\nVerwerkte linetypes uit LIN: " (itoa (length ltNames))))
  (princ (strcat "\nHerstelde layers: " (itoa (- (length layerData) (length restoreFailed)))))

  (if restoreFailed
    (alert
      (strcat
        "RELOADLINETYPE voltooid, maar sommige layers konden niet worden hersteld.\n\n"
        "Waarschijnlijk ontbreken deze linetypes nog na het laden van de LIN.\n\n"
        (apply
          'strcat
          (mapcar
            '(lambda (x) (strcat x "\n"))
            restoreFailed
          )
        )
      )
    )
    (alert
      (strcat
        "RELOADLINETYPE voltooid.\n\n"
        "LIN-bestand:\n"
        linFile
        "\n\nAantal linetypes in LIN: "
        (itoa (length ltNames))
        "\nAantal tijdelijk aangepaste layers: "
        (itoa (length layerData))
      )
    )
  )

  (princ)
)

(princ "\nRELOADLINETYPE geladen. Typ RELOADLINETYPE om een LIN-bestand opnieuw te laden.")
(princ)

 

Edited by Aftertouch
  • Like 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...