<?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: Reload Linetype in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/10159244#M20028</link>
    <description>&lt;P&gt;does reloadlinetype works&lt;SPAN style="font-family: inherit;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it doesn't work in my computer CAD2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using acCurDb.WblockCloneObjects(acTempLineTypeObjIdColl, acCurDb.LinetypeTableId(), acIdMap, DuplicateRecordCloning.Replace, True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;cad&amp;nbsp;crashes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using acCurDb.WblockCloneObjects(acTempLineTypeObjIdColl, acCurDb.LinetypeTableId(), acIdMap, DuplicateRecordCloning.Replace, false)&lt;/P&gt;&lt;P&gt;&amp;nbsp;cad doesn't crashes, but the linetype has no reload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I monitored acIdMap, I found that only one member has cloned，but the member isn't the linetype&lt;/P&gt;</description>
    <pubDate>Tue, 16 Mar 2021 00:51:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-03-16T00:51:28Z</dc:date>
    <item>
      <title>Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9397842#M20020</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;Is it possible to reload a linetype without having to use the send command method. I am familiar with Dev Blogs solution for this but I am curious if it can be done without the send command method. This is what I have so far:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices

Public Class AutocadService
    Implements IAutocadService

    Public Sub LoadLinetype(ByVal selectedLineTypeName As String, ByVal lineTypeFile As String) Implements IAutocadService.LoadLinetype

        Try

            Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
            Dim acCurDb As Database = acDoc.Database

            Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()

                Dim acLineTypTbl As LinetypeTable

                acLineTypTbl = acTrans.GetObject(acCurDb.LinetypeTableId, OpenMode.ForRead)

                If acLineTypTbl.Has(selectedLineTypeName) = True Then

                    'reload linetype somehow

                    Dim frmMessageBox As New frmMessageBox
                    frmMessageBox.lblHeader.Text = "Linetype Loader"
                    frmMessageBox.lblMessageTitle.Text = "Linetype Loaded Successfully!"
                    frmMessageBox.lblMessageBody.Text = "The selected linetype, " &amp;amp; selectedLineTypeName &amp;amp; ", has been re-loaded in the drawing."
                    frmMessageBox.picIcon.Image = My.Resources.msbComplete

                    frmMessageBox.ShowDialog()

                ElseIf acLineTypTbl.Has(selectedLineTypeName) = False Then

                    acCurDb.LoadLineTypeFile(selectedLineTypeName, lineTypeFile)

                    Dim frmMessageBox As New frmMessageBox
                    frmMessageBox.lblHeader.Text = "Linetype Loader"
                    frmMessageBox.lblMessageTitle.Text = "Linetype Loaded Successfully!"
                    frmMessageBox.lblMessageBody.Text = "The selected linetype, " &amp;amp; selectedLineTypeName &amp;amp; ", is now available in the drawing."
                    frmMessageBox.picIcon.Image = My.Resources.msbComplete

                    frmMessageBox.ShowDialog()

                End If

                acTrans.Commit()

            End Using

        Catch ex As Exception

            Dim frmMessageBox As New frmMessageBox
            frmMessageBox.lblHeader.Text = "Linetype Loader"
            frmMessageBox.lblMessageTitle.Text = "Linetype Loading Failed!"
            frmMessageBox.lblMessageBody.Text = "Ensure you are using a proper drawing and/or the existing text styles are loaded."
            frmMessageBox.picIcon.Image = My.Resources.msbError

            frmMessageBox.ShowDialog()

        End Try

    End Sub

End Class&lt;/LI-CODE&gt;&lt;P&gt;If the line type exists it errors out. I want it to just reload it.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 21:17:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9397842#M20020</guid>
      <dc:creator>David_Prontnicki</dc:creator>
      <dc:date>2020-03-24T21:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9397998#M20021</link>
      <description>&lt;P&gt;I don't have a direct example in VB.NET for this, but it should be similar to the concepts shown in this ObjectARX example (&lt;A href="https://adndevblog.typepad.com/autocad/2015/03/reloading-linetype-from-file.html" target="_blank"&gt;https://adndevblog.typepad.com/autocad/2015/03/reloading-linetype-from-file.html&lt;/A&gt;).&amp;nbsp; That is basically creating a new database and loading the linetype into that database, and then copying the linetype from the new database into the database of the current drawing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An example of copying objects from one database to another database with VB.NET can be found here (&lt;A href="https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-E02A8AAF-61FF-4C72-8960-0AEEBBEC2594" target="_blank"&gt;https://help.autodesk.com/view/OARX/2020/ENU/?guid=GUID-E02A8AAF-61FF-4C72-8960-0AEEBBEC2594&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2020 22:45:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9397998#M20021</guid>
      <dc:creator>ambrosl</dc:creator>
      <dc:date>2020-03-24T22:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9399955#M20022</link>
      <description>&lt;P&gt;Thank you for the reply, but I am having hard time understanding that code and converting it to VB. I'm assuming that is C#, but it does not convert in any online converter and even with my basic knowledge of and ability to read C# I am having a hard time making heads or tails of it. Any help would be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 17:18:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9399955#M20022</guid>
      <dc:creator>David_Prontnicki</dc:creator>
      <dc:date>2020-03-25T17:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9401924#M20023</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1706559"&gt;@ambrosl&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to make sure I am understanding you correctly:&lt;EM&gt; "That is basically creating a new database and loading the linetype into that database, and then copying the linetype from the new database into the database of the current drawing."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I create a new database (acLtDbNew), load the linetype I want re-loaded&amp;nbsp;(linetypeToReload) into this new database (acLtDbNew), then copy&amp;nbsp;(linetypeToReload) from&amp;nbsp;(acLtDbNew) to the existing database (acLtDb)?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;By doing this it forces a reload?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Or do you mean:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Create a new database&amp;nbsp;(acLtDbNew), load the linetype I want re-loaded (linetypeToReload) into this new database (acLtDbNew), then &lt;STRONG&gt;copy ALL the other&lt;/STRONG&gt; linetypes (linetypesExisting) from the existing database (acLtDb) into the new database (acLtDbNew) and discard the old database (acLtDb)?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 14:26:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9401924#M20023</guid>
      <dc:creator>David_Prontnicki</dc:creator>
      <dc:date>2020-03-26T14:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9401954#M20024</link>
      <description>&lt;P&gt;The first, as long as you are using the Replace flag when cloning the linetype it should replace the definition in the existing drawing.&amp;nbsp; You may need to force an update on the drawing as well afterwards.&amp;nbsp; &amp;nbsp;I have only personally done this with Dimension Styles and Layers stored in a CAD Standards (DWS) file and brought/updated them into my current drawing, not Linetypes though the concept should be the same.&amp;nbsp; If I get a bit of time today, I will try to create a code sample that does this.&amp;nbsp; Sorry, I have been a bit busy with the AutoCAD 2021 release.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 14:38:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9401954#M20024</guid>
      <dc:creator>ambrosl</dc:creator>
      <dc:date>2020-03-26T14:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9402987#M20025</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1706559"&gt;@ambrosl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No problem I completely understand. Below is what I came up with and it appears to be working, I need to do some more testing to be sure. I ending up having to load some text styles into the temp database for some of the linetypes to load, that is the &lt;STRONG&gt;CreateExistingTextStyle&lt;/STRONG&gt; and &lt;STRONG&gt;CreateProposedTextStyle&lt;/STRONG&gt; you see. What do you mean by force an update to the drawing? Also what is the DeferTranslation as Boolean at end of WblockCloneObjects do? Should that be true or false for what I am doing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, thank you very much for all your help so far. I got a lesson in C++ as well.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    Public Sub ReloadLinetype(ByVal selectedLineTypeName As String, ByVal lineTypeFile As String, ByVal acCurDb As Database)

        Try

            Using acTempDb As Database = New Database(True, True)

                CreateExistingTextStyle(acTempDb)
                CreateProposedTextStyle(acTempDb)
                
                acTempDb.LoadLineTypeFile(selectedLineTypeName, lineTypeFile)

                Using acTempTrans As Transaction = acTempDb.TransactionManager.StartTransaction()

                    Dim acTempLineTypeTbl As LinetypeTable = CType(acTempTrans.GetObject(acTempDb.LinetypeTableId, OpenMode.ForRead), LinetypeTable)

                    Dim acTempLineTypeId As ObjectId = acTempLineTypeTbl(selectedLineTypeName)

                    Dim acTempLineTypeObjIdColl As New ObjectIdCollection

                    acTempLineTypeObjIdColl.Add(acTempLineTypeId)

                    Dim acIdMap As IdMapping = New IdMapping()
                    acCurDb.WblockCloneObjects(acTempLineTypeObjIdColl, acCurDb.LinetypeTableId(), acIdMap, DuplicateRecordCloning.Replace, True)

                    acTempTrans.Commit()

                End Using

            End Using

        Catch ex As Exception

        End Try

    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 21:19:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9402987#M20025</guid>
      <dc:creator>David_Prontnicki</dc:creator>
      <dc:date>2020-03-26T21:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9403115#M20026</link>
      <description>&lt;P&gt;I didn't run the code, but it looks like it follows the correct logic.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Defer Translation flag affects when objects are copied if they are needed but not part of the ID array is my understanding.&amp;nbsp; You can find out more information about defer translation here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/OARX/2021/ENU/?guid=GUID-8A769B63-F192-4235-82B3-0CA2F3BBDFFD" target="_blank"&gt;https://help.autodesk.com/view/OARX/2021/ENU/?guid=GUID-8A769B63-F192-4235-82B3-0CA2F3BBDFFD&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Mar 2020 22:38:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9403115#M20026</guid>
      <dc:creator>ambrosl</dc:creator>
      <dc:date>2020-03-26T22:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9403250#M20027</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1706559"&gt;@ambrosl&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again! I really appreciate it. Just one last question, what did you mean by force an update to the drawing? A regenall or something completely different?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 00:15:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/9403250#M20027</guid>
      <dc:creator>David_Prontnicki</dc:creator>
      <dc:date>2020-03-27T00:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reload Linetype</title>
      <link>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/10159244#M20028</link>
      <description>&lt;P&gt;does reloadlinetype works&lt;SPAN style="font-family: inherit;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it doesn't work in my computer CAD2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using acCurDb.WblockCloneObjects(acTempLineTypeObjIdColl, acCurDb.LinetypeTableId(), acIdMap, DuplicateRecordCloning.Replace, True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;cad&amp;nbsp;crashes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;using acCurDb.WblockCloneObjects(acTempLineTypeObjIdColl, acCurDb.LinetypeTableId(), acIdMap, DuplicateRecordCloning.Replace, false)&lt;/P&gt;&lt;P&gt;&amp;nbsp;cad doesn't crashes, but the linetype has no reload.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I monitored acIdMap, I found that only one member has cloned，but the member isn't the linetype&lt;/P&gt;</description>
      <pubDate>Tue, 16 Mar 2021 00:51:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reload-linetype/m-p/10159244#M20028</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-16T00:51:28Z</dc:date>
    </item>
  </channel>
</rss>

