Ok... i am Very new to .net but i have written a little bit of lisp. SO what i want to do is Create a layer
called C-WATR-PIPE-6IN~ if it does not exist. this i figured out and is in the Code
Then if that layer Exist i want it to create C-WATR-PIPE-6IN~-SUP1 Again its in the Code below but how do i get it to automatically
go to the next number as in C-WATR-PIPE-6IN~-SUP2 i've tried everything i can think of but i get an error that object already exist so its still reading
the Sup 1 i just want it to keep adding Layers Sith the Sup1, 2, 3, Etc each time i run the command
See Code Below
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Colors
Imports Autodesk.AutoCAD.DatabaseServices
Public Class SupLyr
<CommandMethod("SupLyrs")>
Public Sub SupLyrs()
'' Get The Current Document and Database
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
'' Start a Transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Open the Layer Table for Read
Dim acLyrTbl As LayerTable
acLyrTbl = acTrans.GetObject(acCurDb.LayerTableId,
OpenMode.ForRead)
Dim HALayerName As String = "C-WATR-PIPE-6IN~"
Dim sLayerSup As String = "-SUP"
Dim NSup As Integer = 0
If acLyrTbl.Has(HALayerName) = False Then
Using acLyrTblRec As LayerTableRecord = New LayerTableRecord()
'' assign the Layer a Name
acLyrTblRec.Name = HALayerName
'' Assign the Layer a Color
acLyrTblRec.Color = Color.FromColorIndex(ColorMethod.ByAci, 130)
'' Upgrade the Layer table for write
acLyrTbl.UpgradeOpen()
'' Append the new layer to the Layer table and the transaction
acLyrTbl.Add(acLyrTblRec)
acTrans.AddNewlyCreatedDBObject(acLyrTblRec, True)
End Using
End If
If acLyrTbl.Has(HALayerName) = True Then
Using acLyrTblRec As LayerTableRecord = New LayerTableRecord()
'' assign the Layer a Name
acLyrTblRec.Name = HALayerName + sLayerSup & NSup
'' Upgrade the Layer table for write
acLyrTbl.UpgradeOpen()
'' Append the new layer to the Layer table and the transaction
acLyrTbl.Add(acLyrTblRec)
acTrans.AddNewlyCreatedDBObject(acLyrTblRec, True)
'' Save the changes and dispose of the transaction
acTrans.Commit()
End Using
End If
End Using
End Sub
End Class
Thanks
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Solved by Keith.Brown. Go to Solution.
This is off the top of my head but it should work. Its pseudo code but basically start with your base name and add an index to it until the layer table no longer has that name. The trick is to keep the original name untouched to use as a base point.
layerName = "C-WATR-PIPE-6"
tempName = layerName index = 1 While Not acLyrTble.Has(tempName)
tempName = layerName + index index++ End While
database.CreateLayer(tempName)
And where in my Code would i put that Code?
Oh Sorry this is for Civil 3D 2017
Here is a complete method that is working. Note that there was an issue with my pseudo code. I had While Not blah blah blah and it should have been while blah blah blah
C#
[CommandMethod("CreateLayerTest")] public void CreateLayerTest() { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; using (Transaction tr = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead); string layerName = "C-WATR-PIPE-6IN"; string tempName = layerName; int index = 1; while (lt.Has(tempName)) { tempName = layerName + "-SUP" + index; index++; } if (index != 1) { layerName = layerName + "-SUP" + (index - 1); } LayerTableRecord ltr = new LayerTableRecord(); ltr.Name = layerName; ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, 130); lt.UpgradeOpen(); lt.Add(ltr); tr.AddNewlyCreatedDBObject(ltr, true); tr.Commit(); } }
VB
<CommandMethod("CreateLayerTest")> _ Public Sub CreateLayerTest() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Using tr As Transaction = db.TransactionManager.StartTransaction() Dim lt As LayerTable = DirectCast(tr.GetObject(db.LayerTableId, OpenMode.ForRead), LayerTable) Dim layerName As String = "C-WATR-PIPE-6IN" Dim tempName As String = layerName Dim index As Integer = 1 While lt.Has(tempName) tempName = layerName + "-SUP" + index index += 1 End While If index <> 1 Then layerName = layerName + "-SUP" + (index - 1) End If Dim ltr As New LayerTableRecord() ltr.Name = layerName ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, 130) lt.UpgradeOpen() lt.Add(ltr) tr.AddNewlyCreatedDBObject(ltr, True) tr.Commit() End Using End Sub
It should not matter whether or not you are in regular autocad or a vertical like Civil3d. The code should work in all.
Thanks i will see what i can work up here with this..
i'll be back
OK... it Created the first layer ok... but when i run it again i get the following error
I copied your Text Exactly.. what did i do wrong... no errors in the Build
Application does not support just-in-time (JIT)
debugging. See the end of this message for details.
************** Exception Text **************
System.InvalidCastException: Conversion from string "C-WATR-PIPE-6IN-SUP" to type 'Double' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
at Lab1.CreateLayerTest.CreateLayerTest() in C:\Codes\Lab1-RDS\Lab1-RDS\Class5.vb:line 19
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1637.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
Acdbmgd
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcdbMgd.DLL
----------------------------------------
adui21
Assembly Version: 0.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/adui21.DLL
----------------------------------------
AdUiPalettes
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AdUiPalettes.DLL
----------------------------------------
WindowsBase
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1638.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1638.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1637.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
PresentationFramework
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1638.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
PresentationCore
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1638.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
System.Xaml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1638.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
AdApplicationFrame
Assembly Version: 0.0.0.0
Win32 Version: 2015.11.2.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AdApplicationFrame.DLL
----------------------------------------
AdWindows
Assembly Version: 2016.5.0.0
Win32 Version: 2016.5.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AdWindows.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WindowsFormsIntegration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
PresentationFramework.Aero2
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
accoremgd
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/accoremgd.DLL
----------------------------------------
Acmgd
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Acmgd.DLL
----------------------------------------
AcWindows
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcWindows.DLL
----------------------------------------
AcWindows.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcWindows.resources.DLL
----------------------------------------
AcCui
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcCui.DLL
----------------------------------------
PresentationFramework-SystemXml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
----------------------------------------
PresentationFramework.Aero
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
AeccUiWindows
Assembly Version: 11.0.771.0
Win32 Version: 11.0.771.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccUiWindows.dll
----------------------------------------
AeccUiWindows.resources
Assembly Version: 11.0.659.0
Win32 Version: 11.0.659.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/en-US/AeccUiWindows.resources.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
PresentationUI
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationUI/v4.0_4.0.0.0__31bf3856ad364e35/PresentationUI.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
PresentationFramework-SystemXmlLinq
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXmlLinq/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXmlLinq.dll
----------------------------------------
AcSeamless
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcSeamless.DLL
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
AcSeamless.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcSeamless.resources.DLL
----------------------------------------
AmbercoreEngine
Assembly Version: 0.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AmbercoreEngine.DLL
----------------------------------------
AmberCore.IsdCodecAPI.Core
Assembly Version: 5.0.0.343
Win32 Version: 5.0.0.343
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AmberCore.IsdCodecAPI.Core.DLL
----------------------------------------
AecMgdReverse
Assembly Version: 7.9.48.0
Win32 Version: 7.9.48.0
CodeBase: file:///c:/program%20files/autodesk/autocad%202017/aca/aecmgdreverse.dll
----------------------------------------
AecRibbon
Assembly Version: 7.9.48.0
Win32 Version: 7.9.48.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/ACA/AecRibbon.dll
----------------------------------------
AecGuiInterop
Assembly Version: 7.9.48.0
Win32 Version: 7.9.48.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/ACA/AecGuiInterop.DLL
----------------------------------------
AcMapResourceManagement
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///c:/program%20files/autodesk/autocad%202017/map/AcMapResourceManagement.dll
----------------------------------------
AcMapLoader
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///c:/program%20files/autodesk/autocad%202017/map/acmaploader.arx
----------------------------------------
ConvertText
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/ConvertText.dll
----------------------------------------
OSGeo.MapGuide.PlatformBase
Assembly Version: 1.0.0.1
Win32 Version: 1.0.0.1
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/OSGeo.MapGuide.PlatformBase.DLL
----------------------------------------
OSGeo.MapGuide.Foundation
Assembly Version: 1.0.0.1
Win32 Version: 1.0.0.1
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/OSGeo.MapGuide.Foundation.DLL
----------------------------------------
Autodesk.Map.Platform
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/Autodesk.Map.Platform.DLL
----------------------------------------
MapPublishImp
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/MapPublishImp.DLL
----------------------------------------
Autodesk.MapGuide.Studio.Site
Assembly Version: 2.2.0.1
Win32 Version: 2.2.0.1
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/Autodesk.MapGuide.Studio.Site.DLL
----------------------------------------
AcMapFeatureEntityTooltipsManager
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/map/AcMapFeatureEntityTooltipsManager.dll
----------------------------------------
ResourceManagerRdfImp
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Map/ResourceManagerRdfImp.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1636.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
PresentationFramework-SystemData
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemData/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemData.dll
----------------------------------------
AREXC3DStartX64
Assembly Version: 2017.0.1.3897
Win32 Version: 2017.0.1.3897
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Products/Civil3D/AREXC3DStartX64.dll
----------------------------------------
Autodesk.REX.Framework
Assembly Version: 2017.0.0.0
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Autodesk.REX.Framework/v4.0_2017.0.0.0__51e16e3b26b42eda/Autodesk.REX.Framework.dll
----------------------------------------
Autodesk.Common.AResourcesControl
Assembly Version: 1.0.0.0
Win32 Version: 2013.1.0.0
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Autodesk.Common.AResourcesControl/1.0.0.0__ff3304d4f320ee59/Autodesk.Common.AResourcesControl.dll
----------------------------------------
REX.Manager
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.Manager.dll
----------------------------------------
Autodesk.AutoCAD.Interop
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Autodesk.AutoCAD.Interop.DLL
----------------------------------------
Autodesk.AutoCAD.Interop.Common
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Autodesk.AutoCAD.Interop.Common.DLL
----------------------------------------
Autodesk.AECC.Interop.UiLand
Assembly Version: 11.0.0.0
Win32 Version: 11,0,659,0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/Autodesk.AECC.Interop.UiLand.dll
----------------------------------------
Autodesk.AEC.Interop.UIBase
Assembly Version: 7.9.0.0
Win32 Version: 7.9.48.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/ACA/Autodesk.AEC.Interop.UIBase.dll
----------------------------------------
Autodesk.AECC.Interop.Land
Assembly Version: 11.0.0.0
Win32 Version: 11,0,659,0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/Autodesk.AECC.Interop.Land.dll
----------------------------------------
AREXC3DMngr
Assembly Version: 2017.0.1.3897
Win32 Version: 2017.0.1.3897
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Products/Civil3D/AREXC3DMngr.dll
----------------------------------------
REX.Engine
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.Engine.dll
----------------------------------------
REX.Preferences
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.Preferences.DLL
----------------------------------------
REX.System
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.System.DLL
----------------------------------------
REX.UI.Forms
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.UI.Forms.DLL
----------------------------------------
REX.UI
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.UI.DLL
----------------------------------------
REX.UI.WPF
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/REX.UI.WPF.DLL
----------------------------------------
REX.UI.resources
Assembly Version: 2017.0.0.3871
Win32 Version: 2017.0.0.3871
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/en-US/REX.UI.resources.DLL
----------------------------------------
REX.Foundation
Assembly Version: 2017.0.0.3866
Win32 Version: 2017.0.0.3866
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Foundation/REX.Foundation.dll
----------------------------------------
REX.System.resources
Assembly Version: 2017.0.0.3871
Win32 Version: 2017.0.0.3871
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Framework/Engine/en-US/REX.System.resources.dll
----------------------------------------
AREXC3DStartX64.resources
Assembly Version: 2017.0.0.3896
Win32 Version: 2017.0.0.3896
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/Extensions%202017/Products/Civil3D/en-US/AREXC3DStartX64.resources.dll
----------------------------------------
AcCustomize
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcCustomize.DLL
----------------------------------------
AcCustomize.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcCustomize.resources.DLL
----------------------------------------
atrc210_ARX
Assembly Version: 0.0.0.0
Win32 Version: 17, 1, 1784, 0
CodeBase: file:///C:/program%20files/autodesk/autodesk%20vehicle%20tracking%202017/atrc210_arx.dll
----------------------------------------
atrc210_CRX
Assembly Version: 0.0.0.0
Win32 Version: 17, 1, 1784, 0
CodeBase: file:///C:/program%20files/autodesk/autodesk%20vehicle%20tracking%202017/atrc210_crx.dll
----------------------------------------
EmbeddedSQLiteLoader
Assembly Version: 0.0.0.0
Win32 Version:
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/EmbeddedSQLiteLoader.dll
----------------------------------------
AcMapInfoCenter
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Map/AcMapInfoCenter.dll
----------------------------------------
AeccPartPublishingWizard
Assembly Version: 11.0.771.0
Win32 Version: 11.0.771.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccPartPublishingWizard.dll
----------------------------------------
RiverRibbon140
Assembly Version: 14.1.1.1
Win32 Version: 14.1.1.1
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/Autodesk%20RiverRibbon.bundle/Contents/RiverRibbon140.dll
----------------------------------------
BIM360GlueAutoCAD2017Addin
Assembly Version: 4.37.6853.0
Win32 Version: 4.37.6853.0
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/AutoCAD2017Addin.bundle/Contents/Win64/BIM360GlueAutoCAD2017Addin.dll
----------------------------------------
BIM360GlueAddinsCommon
Assembly Version: 4.37.6853.0
Win32 Version: 4.37.6853.0
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/AutoCAD2017Addin.bundle/Contents/Win64/BIM360GlueAddinsCommon.DLL
----------------------------------------
log4net
Assembly Version: 1.2.11.0
Win32 Version: 1.2.11.0
CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/AutoCAD2017Addin.bundle/Contents/Win64/log4net.DLL
----------------------------------------
CivilView.v1
Assembly Version: 2016.0.0.0
Win32 Version: 2016.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/CivilView.v1.dll
----------------------------------------
CVE.Data.Civil.v1
Assembly Version: 2014.0.0.0
Win32 Version: 2014.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/CVE.Data.Civil.v1.DLL
----------------------------------------
Ignytion.Core.v1
Assembly Version: 1.0.10078.134
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/Ignytion.Core.v1.DLL
----------------------------------------
FeaturedAppsPlugin
Assembly Version: 21.0.0.0
Win32 Version: 21.0.46.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Autodesk/ApplicationPlugins/Autodesk%20FeaturedApps.bundle/Contents/Windows/2017/Win64/FeaturedAppsPlugin.dll
----------------------------------------
C3DVSP3D
Assembly Version: 3.3.0.0
Win32 Version: 2016.0.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/C3DVSP3D.dll
----------------------------------------
PresentationFramework-SystemCore
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemCore/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemCore.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
Assembly Version: 0.0.0.0
Win32 Version: 4.6.1637.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------
UIAutomationTypes
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
ContextualTabSelectorRules
Assembly Version: 0.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcWindows.dll
----------------------------------------
AeccUiMgd
Assembly Version: 11.0.771.0
Win32 Version: 11,0,771,0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccUiMgd.DLL
----------------------------------------
AeccPressurePipesMgd
Assembly Version: 11.0.771.0
Win32 Version: 11,0,771,0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccPressurePipesMgd.DLL
----------------------------------------
AcMapRibbonWrapper
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Map/AcMapRibbonWrapper.dll
----------------------------------------
AcMapRibbon
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Map/AcMapRibbon.dll
----------------------------------------
AeccContextTabRules
Assembly Version: 11.0.771.0
Win32 Version: 11.0.771.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccContextTabRules.dll
----------------------------------------
AeccWindows
Assembly Version: 11.0.771.0
Win32 Version: 11.0.771.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccWindows.DLL
----------------------------------------
AeccDbMgd
Assembly Version: 11.0.771.0
Win32 Version: 11,0,771,0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccDbMgd.DLL
----------------------------------------
Microsoft.Expression.Interactions
Assembly Version: 4.0.0.0
Win32 Version: 2.0.20520.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Microsoft.Expression.Interactions.DLL
----------------------------------------
ManagedMC3
Assembly Version: 9.1.0.7
Win32 Version: 9.1.0.7
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/ManagedMC3.DLL
----------------------------------------
AcLayer
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcLayer.DLL
----------------------------------------
AcLayer.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcLayer.resources.DLL
----------------------------------------
AecLayerManagerEx
Assembly Version: 7.9.48.0
Win32 Version: 7.9.48.0
CodeBase: file:///C:/program%20files/autodesk/autocad%202017/aca/AecLayerManagerEx.dll
----------------------------------------
UIAutomationProvider
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
AcAeNet.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcAeNet.resources.DLL
----------------------------------------
AcCloudRender.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcCloudRender.resources.DLL
----------------------------------------
AcDxWizard.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcDxWizard.resources.DLL
----------------------------------------
AcExportLayoutUI.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcExportLayoutUI.resources.DLL
----------------------------------------
AcInterfere.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcInterfere.resources.DLL
----------------------------------------
AcLayerTools.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcLayerTools.resources.DLL
----------------------------------------
AcMrUi.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcMrUi.resources.DLL
----------------------------------------
AcMultiLineUi.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcMultiLineUi.resources.DLL
----------------------------------------
AcRecoverAll.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcRecoverAll.resources.DLL
----------------------------------------
AcScaleList.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcScaleList.resources.DLL
----------------------------------------
AcUnderlay.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcUnderlay.resources.DLL
----------------------------------------
AcViewTransitionsUi.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcViewTransitionsUi.resources.DLL
----------------------------------------
AdskConnectionPointMgd.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AdskConnectionPointMgd.resources.DLL
----------------------------------------
AcCalcUi.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcCalcUi.resources.DLL
----------------------------------------
AcXrefUtil
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcXrefUtil.DLL
----------------------------------------
ClicJsInfoCenter
Assembly Version: 0.0.0.0
Win32 Version: 3.1.26.0
CodeBase: file:///C:/Program%20Files/Common%20Files/Autodesk%20Shared/CLM/V3/MSVC14/ClicJsInfoCenter.dll
----------------------------------------
AecBaseMgd
Assembly Version: 7.9.48.0
Win32 Version: 7.9.48.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AecBaseMgd.DLL
----------------------------------------
AcLivePreviewContext
Assembly Version: 0.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcWindows.dll
----------------------------------------
PresentationFramework.Luna
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Luna/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Luna.dll
----------------------------------------
AcMrUi
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcMrUI.DLL
----------------------------------------
Lab1-RDS
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Codes/Lab1-RDS/Lab1-RDS/bin/Debug/Lab1-RDS.dll
----------------------------------------
FeaturedAppsPlugin.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.46.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Autodesk/ApplicationPlugins/Autodesk%20FeaturedApps.bundle/Contents/Windows/2017/Win64/en-US/FeaturedAppsPlugin.resources.DLL
----------------------------------------
AcCommandToolTips
Assembly Version: 21.0.0.0
Win32 Version: 21.0.301.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/AcCommandToolTips.DLL
----------------------------------------
AcCommandToolTips.resources
Assembly Version: 0.0.0.0
Win32 Version: 21.0.212.0.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/en-US/AcCommandToolTips.resources.DLL
----------------------------------------
VerticalTips
Assembly Version: 20.0.200.3
Win32 Version: 20.0.200.3
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/Map/VerticalTips.dll
----------------------------------------
AeccUiTooltipContent
Assembly Version: 11.0.771.0
Win32 Version: 11.0.771.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/AeccUiTooltipContent.dll
----------------------------------------
AeccUiTooltipContent.resources
Assembly Version: 11.0.659.0
Win32 Version: 11.0.659.0
CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202017/C3D/en-US/AeccUiTooltipContent.resources.DLL
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 14.6.1586.0 built by: NETFXREL2
CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
************** JIT Debugging **************
Application does not support Windows Forms just-in-time (JIT)
debugging. Contact the application author for more
information.
Hi,
You do not need to paste the whole error message, just attentively read the ************** Exception Text ************** part.
It looks like you're trying to cast the string "C-WATR-PIPE-6IN-SUP" to double at line 19 of your code.
rogershaw1237 a écrit :
************** Exception Text **************
System.InvalidCastException: Conversion from string "C-WATR-PIPE-6IN-SUP" to type 'Double' is not valid. ---> System.FormatException: Input string was not in a correct format.
at Microsoft.VisualBasic.CompilerServices.Conversions.ParseDouble(String Value, NumberFormatInfo NumberFormat)
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
--- End of inner exception stack trace ---
at Microsoft.VisualBasic.CompilerServices.Conversions.ToDouble(String Value, NumberFormatInfo NumberFormat)
at Lab1.CreateLayerTest.CreateLayerTest() in C:\Codes\Lab1-RDS\Lab1-RDS\Class5.vb:line 19
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
Sorry. I wrote the code in C# and converted it to VB for your use and made a small mistake. The issue is with using the + signs when concatenating strings. You can use the plus sign when you are concatenating only strings but once you add a non string then you need to use the ampersand. Or you can just use the .ToString() method on the index variable.
If small errors like this are giving you a problem then you should really try to learn more about .Net before programming autocad. It is a large leap without knowing the basics of .Net.
and how do i fix that??
as i said i am learning here
Updated VB Code with Ampersands instead of Plus signs for concatenating strings. Tested and working in AutoCAD.
<CommandMethod("CreateLayerTest")> _ Public Sub CreateLayerTest() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Using tr As Transaction = db.TransactionManager.StartTransaction() Dim lt As LayerTable = DirectCast(tr.GetObject(db.LayerTableId, OpenMode.ForRead), LayerTable) Dim layerName As String = "C-WATR-PIPE-6IN" Dim tempName As String = layerName Dim index As Integer = 1 While lt.Has(tempName) tempName = layerName & "-SUP" & index index += 1 End While If index <> 1 Then layerName = layerName & "-SUP" & (index - 1) End If Dim ltr As New LayerTableRecord() ltr.Name = layerName ltr.Color = Color.FromColorIndex(ColorMethod.ByAci, 130) lt.UpgradeOpen() lt.Add(ltr) tr.AddNewlyCreatedDBObject(ltr, True) tr.Commit() End Using End Sub
Hi,
If you absolutely need to use/learn VB, replace the + operator which is also a concatenation operator in C#, with the VB concatenation operator: &.
As Keith said, you should first learn the .NET basics before trying to use the AutoCAD API which not so easy to learn.
That said, I'd add that if you just start learning .NET, learn C# instead of VB because you'll find much more help an good examples in C# than in VB.
Thanks guys.. i am doing my best here...
i have a book coming on .net and i also have the Autocad Platform Customization
and am searching the net recklessly...
i am gonna try to learn this and with help from guys like you i should be able to