Author Topic: Civil 3D Styles | Get Count Failed  (Read 3012 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Civil 3D Styles | Get Count Failed
« on: March 27, 2012, 08:53:51 AM »
Recently, I asked for some help with Civil 3D Styles, and thanks to Jeff - I now have a DLL which does what I am after... for Civil 3D 2012... my Civil 3D 2011 deployment however does not like using the DLL for some reason.

Here's a link to download the file I am using: C3D Style Tools.zip

Whereas for others the DLL works fine in 2011, so I'm trying to deduce what is causing this issue on my end, and am getting nowhere. Any assistance would be greatly appreciated.

Netload is fine, CommandMethod invocation is fine, and I am prompted for the appropriate string, then it fails, citing 'Get Count Failed'... Here is the error I receive:

Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
Autodesk.Civil.CivilException: Get Count Failed
   at Autodesk.Civil.DatabaseServices.Styles.StyleCollectionBase.get_Count()
   at Autodesk.Civil.CollectionEnumerator<Autodesk::Civil::DatabaseServices::Styles::StyleCollectionBase\,Autodesk::AutoCAD::DatabaseServices::ObjectId>..ctor(StyleCollectionBase pCollection)
   at Autodesk.Civil.DatabaseServices.Styles.StyleCollectionBase.GetEnumerator()
   at StyleTools.StylesCreatedByUpdate.ListCollection(Type objectType, PropertyInfo pf, Object myStylesRoot)
   at StyleTools.StylesCreatedByUpdate.ListRoot(Object root)
   at StyleTools.StylesCreatedByUpdate.createdbycommand()
   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.CommandClass.CommandThunk.Invoke()


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5448 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
----------------------------------------
acdbmgd
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.115.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcdbMgd.DLL
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5453 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
msvcm90
    Assembly Version: 9.0.30729.4940
    Win32 Version: 9.00.30729.4940
    CodeBase: file:///C:/WINDOWS/WinSxS/amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_08e4299fa83d7e3c/msvcm90.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
PresentationFramework
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5011 built by: Win7SP1
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/PresentationFramework/3.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5011 built by: Win7SP1
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/WindowsBase/3.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
PresentationCore
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5011 built by: Win7SP1
    CodeBase: file:///C:/WINDOWS/assembly/GAC_64/PresentationCore/3.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
AdApplicationFrame
    Assembly Version: 0.0.0.0
    Win32 Version: 3.0.269.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AdApplicationFrame.DLL
----------------------------------------
AdWindows
    Assembly Version: 3.0.270.0
    Win32 Version: 3.0.270.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AdWindows.DLL
----------------------------------------
PresentationFramework.Aero
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4902 built by: NetFXw7
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/PresentationFramework.Aero/3.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
acmgd
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.208.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/acmgd.DLL
----------------------------------------
System.Core
    Assembly Version: 3.5.0.0
    Win32 Version: 3.5.30729.5420 built by: Win7SP1
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
AcWindows
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.208.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcWindows.DLL
----------------------------------------
AcWindows.resources
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/en-US/AcWindows.resources.DLL
----------------------------------------
AcCui
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.115.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcCui.DLL
----------------------------------------
AecMgdReverse
    Assembly Version: 6.5.353.0
    Win32 Version: 6, 5, 353, 0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AecMgdReverse.DLL
----------------------------------------
AecRibbon
    Assembly Version: 6.5.353.0
    Win32 Version: 6.5.353.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AecRibbon.DLL
----------------------------------------
AcMapResourceManagement
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcMapResourceManagement.DLL
----------------------------------------
AcMapSurveyMan
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcMapSurveyMan.DLL
----------------------------------------
Autodesk.Gis.Map.SurveyUI
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Autodesk.Gis.Map.SurveyUI.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.5446 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
Autodesk.Gis.Map.Survey
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Autodesk.Gis.Map.Survey.DLL
----------------------------------------
Autodesk.Map.Platform.Core
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Autodesk.Map.Platform.Core.DLL
----------------------------------------
OSGeo.MapGuide.PlatformBase
    Assembly Version: 2.2.0.4206
    Win32 Version: 1.0.0.4206
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/OSGeo.MapGuide.PlatformBase.DLL
----------------------------------------
OSGeo.MapGuide.Foundation
    Assembly Version: 2.2.0.4206
    Win32 Version: 1.0.0.4206
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/OSGeo.MapGuide.Foundation.DLL
----------------------------------------
OSGeo.MapGuide.Geometry
    Assembly Version: 2.2.0.4206
    Win32 Version: 1.0.0.4206
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/OSGeo.MapGuide.Geometry.DLL
----------------------------------------
Autodesk.Gis.Map.Survey.Resource
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Autodesk.Gis.Map.Survey.Resource.DLL
----------------------------------------
AcMapRibbonWrapper
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcMapRibbonWrapper.DLL
----------------------------------------
Autodesk.Gis.Map.Shared
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Autodesk.Gis.Map.Shared.DLL
----------------------------------------
AmbercoreEngine
    Assembly Version: 0.0.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AmbercoreEngine.DLL
----------------------------------------
AmberCore.IsdCodecAPI.Core
    Assembly Version: 5.0.0.343
    Win32 Version: 5.0.0.343
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AmberCore.IsdCodecAPI.Core.DLL
----------------------------------------
AeccMgdReverse
    Assembly Version: 0.0.0.0
    Win32 Version: 8,0,2222,0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccMgdReverse.DLL
----------------------------------------
AeccUiWindows
    Assembly Version: 8.0.2222.0
    Win32 Version: 8.0.2222.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccUiWindows.DLL
----------------------------------------
AeccUiWindows.resources
    Assembly Version: 8.0.1439.0
    Win32 Version: 8.0.1439.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/en-US/AeccUiWindows.resources.DLL
----------------------------------------
AeciRibbon54Res
    Assembly Version: 18.1.15.1
    Win32 Version: 18.1.015.1
    CodeBase: file:///C:/Program%20Files/adsk_raster_design_2011/AeciRibbon54res.dll
----------------------------------------
Redland.NET
    Assembly Version: 0.9.17.6
    Win32 Version: 0.9.17.6
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/Redland.NET.DLL
----------------------------------------
ContextualTabSelectorRules
    Assembly Version: 0.0.0.0
    Win32 Version: 18.1.208.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcWindows.dll
----------------------------------------
AeccWindows
    Assembly Version: 8.0.2222.0
    Win32 Version: 8.0.2222.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccWindows.DLL
----------------------------------------
AeccDbMgd
    Assembly Version: 8.0.2222.0
    Win32 Version: 8,0,2222,0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccDbMgd.DLL
----------------------------------------
AecBaseMgd
    Assembly Version: 6.5.353.0
    Win32 Version: 6, 5, 353, 0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AecBaseMgd.DLL
----------------------------------------
ManagedMC3
    Assembly Version: 4.11.0.0
    Win32 Version: 4.12.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/ManagedMC3.DLL
----------------------------------------
9w5jbjmj
    Assembly Version: 3.0.270.0
    Win32 Version: 2.0.50727.5453 (Win7SP1GDR.050727-5400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
AcLayer
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.208.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcLayer.DLL
----------------------------------------
AcLayer.resources
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/en-US/AcLayer.resources.DLL
----------------------------------------
AeccUiMgd
    Assembly Version: 8.0.2222.0
    Win32 Version: 8,0,2222,0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccUiMgd.DLL
----------------------------------------
UIAutomationProvider
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4902 built by: NetFXw7
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/UIAutomationProvider/3.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------
Accessibility
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
AcCommandToolTips
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AcCommandToolTips.DLL
----------------------------------------
AcCommandToolTips.resources
    Assembly Version: 18.1.0.0
    Win32 Version: 18.1.49.0.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/en-US/AcCommandToolTips.resources.DLL
----------------------------------------
VerticalTips
    Assembly Version: 14.0.206.0
    Win32 Version: 14.0.206.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/VerticalTips.DLL
----------------------------------------
AeccUiTooltipContent
    Assembly Version: 8.0.2222.0
    Win32 Version: 8.0.2222.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/AeccUiTooltipContent.DLL
----------------------------------------
AeccUiTooltipContent.resources
    Assembly Version: 8.0.1439.0
    Win32 Version: 8.0.1439.0
    CodeBase: file:///C:/Program%20Files/adsk_c3d_2011/en-US/AeccUiTooltipContent.resources.DLL
----------------------------------------
PresentationUI
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.4902 built by: NetFXw7
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/PresentationUI/3.0.0.0__31bf3856ad364e35/PresentationUI.dll
----------------------------------------
PresentationFramework.Luna
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.5011 built by: Win7SP1
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/PresentationFramework.Luna/3.0.0.0__31bf3856ad364e35/PresentationFramework.Luna.dll
----------------------------------------
C3D StyleTools
    Assembly Version: 0.0.0.0
    Win32 Version: 0.0.0.0
    CodeBase: file:///C:/_remote_drives/R/cad/support/water/common/app/style_tools/C3D%20StyleTools.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil 3D Styles | Get Count Failed
« Reply #1 on: March 27, 2012, 09:49:56 AM »
Is this a 32 bit install? Are you still using the modified acad.exe.config? Does this error occur with all drawings?

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Get Count Failed
« Reply #2 on: March 27, 2012, 10:05:04 AM »
64 Bit (Windows 7), OOTB acad.exe.Config, and it does not fail with every drawing.

Having just tested this, acad.dwt fails, but "_AutoCAD Civil 3D (Imperial) NCS.dwt" is successful.

If no QNEW is specified, does C3D default to acad.dwt? I did confirm the the 2011 profile has no DWT set as QNEW, whereas 2012 is set for NCS as above. Works in 2012 , not in 2011... The template may be my issue.
"How we think determines what we do, and what we do determines what we get."

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Get Count Failed
« Reply #3 on: March 27, 2012, 10:08:18 AM »
Additional testing shows that our corporate template also fails, but the template that I've been preparing does not... Mine used "_AutoCAD Civil 3D (Imperial) NCS.dwt" as a starting point. Not sure about the corporate template.

Edit - What doesn't make sense is that even in acad.dwt there are styles... albeit 'standard' ones, but they're there. Why would the code fail at 'Get Count' because the styles are from acad.dwt?
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil 3D Styles | Get Count Failed
« Reply #4 on: March 27, 2012, 10:15:42 AM »
OK, I can duplicate the error by changing my QNEW template to none, then choosing the acad3d.dwt to start a new drawing from. Not sure why these generic dwt's would ever be used to start a C3D drawing with, but I will see if there's a way to trap this issue.

BlackBox

  • King Gator
  • Posts: 3770
Re: Civil 3D Styles | Get Count Failed
« Reply #5 on: March 27, 2012, 10:25:06 AM »
Confirmed that the issue is the template, and not the acad.exe.Config file, as I've restored Kean's configuration to allow remote sources, and get same results as above.

I agree that one should have a QNEW specified, but unfortunately there seems to be a distinction between even which template is used as a starting point for one's corporate template. For example, I opened acad.dwt, added a new surface style, then attempt CreatedByUpdate and still result in fatal error.

I am beginning to suspect that the corporate template was started by acad.dwt and not the NCS template (which is odd, given that we're NCS based, but still). I need to try to pinpoint what about any given template would cause this... that may be asking too much. LoL
"How we think determines what we do, and what we do determines what we get."

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil 3D Styles | Get Count Failed
« Reply #6 on: March 27, 2012, 10:30:42 AM »
Looks like the problem is with drawings brought forward and have not had certain commands run to instantiate certain styles.....the first error I'm seeing is occurring on the ProfileDesignCheckSetCollection, and it's being thrown due to the collection has not been initialized. I think I know how to work around this, stay tuned.

huiz

  • Swamp Rat
  • Posts: 913
  • Certified Prof C3D
Re: Civil 3D Styles | Get Count Failed
« Reply #7 on: March 27, 2012, 10:34:22 AM »
If you use a template without styles, there might not be a stylecollection, and so you can't use the count method.

You better check first if there is any style collection.


 Try
      Dim tmpCounter As Integer
      tmpCounter = <your style collection here>.Count
 Catch ex As Autodesk.Civil.CivilException
     ' Some error, there are no styles.
     ' <print your ex.message>
  End Try
The conclusion is justified that the initialization of the development of critical subsystem optimizes the probability of success to the development of the technical behavior over a given period.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil 3D Styles | Get Count Failed
« Reply #8 on: March 27, 2012, 10:40:46 AM »
Yes, this now works by adding 2 lines of code....
Code - C: [Select]
  1.         private static void ListCollection(Type objectType, PropertyInfo pf, object myStylesRoot)
  2.         {
  3.  
  4.             object res = objectType.InvokeMember(pf.Name,
  5.                             BindingFlags.GetProperty, null, myStylesRoot, new object[0]);
  6.             if (res.Equals(null))
  7.                 return;
  8.  
  9.             StyleCollectionBase scBase = (StyleCollectionBase)res;
  10.             //added the following to eliminate error thrown when a collection has not yet been initialized
  11.             try { int i = scBase.Count; }
  12.             catch { return; }
  13.  
  14.             foreach (ObjectId sbid in scBase)
  15.             {.......
  16.  

I've added a message with attachment to the original thread.
« Last Edit: March 27, 2012, 10:49:29 AM by Jeff_M »

airportman

  • Newt
  • Posts: 37
  • i customize when required
Re: Civil 3D Styles | Get Count Failed
« Reply #9 on: January 05, 2021, 12:18:02 PM »
Jeff - have you created an update dll for this since version 2012?

I'm looking for a way to export my C3D Template contents to either a CSV or another database type format.
Trying to build a framework document for tracking.
Perception is a state of mind  -/ Twitter = @hochanz -/ Intel i7 - 3.07GHz -/ 12GB Ram -/ Nvidia Quadro FX 1800

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Civil 3D Styles | Get Count Failed
« Reply #10 on: January 05, 2021, 06:17:55 PM »
Not sure how that dll would help you export anything. There used to be a Sample program to Export text file of all the style names that was included with C3D. I still have my modified copy, which creates an XML file instead. A DLL compiled for C3D 2016 (and works with all newer releases) is attached. If you need it to output more data for each style, I can post the source code for you to modify as needed.