Showing posts with label .NET. Show all posts
Showing posts with label .NET. Show all posts

Tuesday, April 2, 2013

ObjectARX 2014 and AutoCAD 2014 .NET Training

Autodesk has posted the ObjectARX 2014 and AutoCAD 2014 .NET Training materials to AutoCAD developer page under Learning section.
Visit http://www.autodesk.com/developautocad for downloading the Training materials.

The following new or changed features are now exposed through the API:

  • Connected Desktop - Design Feed
  • Geolocation
  • Point Cloud

There are also quite a few other useful news for developers. For example for .NET these are some examples: MLeader.Scale Property that gets or sets the scale for the MLeader or RegionAreaProperties with properties to get area, centroid point, extents, moments of inertia, perimeter, principal moments, product of inertia and radii of gyration.

See also AutoCAD 2014 API for more.

Monday, April 23, 2012

No source available in Visual Studio debugging AutoCAD .NET code

AutoCAD 2011 through AutoCAD 2013 is being in progress migrating to fiberless operation. See Wikipedia for more about Fibers.

This affects ARX application using acedCommand (replaced with acedCommandS and acedCommandC), acedCmd (replaced with acedCmdS and acedCmdC) as well as ARX or .NET application using AcApDocManager functions to create, close or activate documents. If P/Invoke has been used to access acedCommand in .NET API, it will not work.  Finally LISP *error* handlers using the (command) function. In most cases you simply have to replace (command) from within an *error* handler with calls to the new (command-s) function. Worth knowing is that (command-s) is significantly faster than (command). A limitation with (command-s) is that “pause” tokens cannot be used and the expression must represent complete commands..

AutoCAD 2011 introduced two variables FIBERWORLD and NEXTFIBERWORLD to help programmers to test and migrate code.
FIBERWORLD = 1 if Fibers are being used.
Change NEXTFIBERWORLD to 0 to disable fibers and 1 to enable fibers. Close and relaunch AutoCAD, or close all the current documents in AutoCAD and then open/new one.

If breakpoints in custom forms being opened using ShowModalDialog or ShowDialog cannot be hit when debugging .NET addins in Visual Studio 2010 the workaround is to set AutoCAD to run in fiberless operation (FIBERWORLD = 0). When you try to debug you may see this message in Visual Studio: No Source Available. No symbols are loaded for any call stack frame. The source code cannot be displayed.

The problem that you may have with FIBERWORLD = 0 is that the Ribbon is not working, you may get strange crashes and have other issues. If you cannot type any commands you may need to disable and enable the command line using the application menu and search for command. If you need to work on a specific drawing it can help to load it automatically from within the Visual Studio debugger as the open command may break the command functionality.

When ready remember to set back AutoCAD to run in fiber mode again.

Monday, April 9, 2012

VBA Download for AutoCAD 2013

VBA (Microsoft Visual Basic for Applications) is still available in AutoCAD 2013 but it is not included with the installation media. Find the VBA for AutoCAD downloads here at http://www.autodesk.com/vba-download. There downloads are found also for AutoCAD 2010, AutoCAD 2011, AutoCAD 2012 in both 32-bit and 64-bit.

If you have existing VBA this can be good news but don’t get started to develop anything new in VBA for AutoCAD as we don’t know if this will be the last release with VBA or not. Consider to convert the code to .NET (C# or VB.NET) and if you like help with it please feel free to contact us.

Sunday, March 11, 2012

Extract zip files in VB.NET

Here is one way to extract zip files. The example is done in VB.NET using the Shell COM.

Declarations needed:

Imports System.IO
' Add COM reference "Microsoft Shell Controls And Automation"
Imports Shell32

Code snippet:

Dim ZipFile As String = "D:\temp\files.zip"
Dim ZipDir As String = "D:\temp\files\"
Dim Shell As Shell32.IShellDispatch2
Dim ShellFolder As Shell32.Folder

If File.Exists(ZipFile) Then
    Shell = CType(CreateObject("Shell.Application"), IShellDispatch2)

    If Not Directory.Exists(ZipDir) Then Directory.CreateDirectory(ZipDir)
    ShellFolder = Shell.NameSpace(ZipDir)
    If ShellFolder IsNot Nothing Then
        ShellFolder.CopyHere(Shell.NameSpace(ZipFile).Items)
    End If
End If

One downside with this approach is that a dialog box can show up while extracting the zip file.

Other ways to Zip and Unzip in C#, VB, any .NET language is using DotNetZip (recommended) or SharpZipLib as well as SevenZipSharp for 7z (7-zip). There is also the GZipStream Class that comes with .NET Framework but only works with .gz files. System.IO.Packaging.ZipPackage is available in .NET Framework 3 and newer but is not straightforward to use and not recommended.

Monday, March 5, 2012

.NET Framework requirements and versions

Normally it is a good idea to keep older .NET Framework versions. For example if you only have .NET Framework 4 installed and a software requires .NET Framework 3.5 a dialog box as below can be seen during installation. The solution is to install the version the dialog box indicates.

For users

A dialog box showing something like this can be seen: This setup requires the .NET Framework version 3.5. Please install the .NET Framework and run this setup again. The .NET Framework can be obtained from the web. Would you like to do this now?

In the setup log found in %TEMP% this can be seen for example:
Install state for .NET Framework 1.0: not installed.
Install state for .NET Framework 1.1: not installed.
Install state for .NET Framework 2.0: installed with service pack 2.
Install state for .NET Framework 3.0: not installed.
Install state for .NET Framework 3.5: not installed.
Install state for .NET Framework 4 Client: installed with no service packs.
Install state for .NET Framework 4 Full: installed with no service packs.

To find out what Framework is installed and also if it’s working as expected use .NET Framework Setup Verification Tool.

For programmers

Using Visual Studio setup project the launch condition is set to .NET Framework 3.5 as requirement on the target machine. Checking the MSI using Orca, VSDFrameworkVersion is v3.5 and VSDAllowLaterFrameworkVersions is set to True. So even though later versions are allowed you still need the required version, in this case v3.5. Lesson learned is that you cannot specify system requirement like .NET Framework v3.5 or later.

Friday, September 2, 2011

Free AutoCAD .NET training online

Free online AutoCAD .NET training starting September 8th

This is good news if you would like to learn to program in .NET for AutoCAD.

Starting next week – and for 8 weeks – Wayne Brill, from DevTech Americas, will be delivering free online AutoCAD .NET training live so Wayne will be able to interact with the audience and answer any questions you might have.

To register – yes, for free – go to our API Training page and select “Schedule”, then scroll down to “AutoCAD .NET”, “English”, “Webcast”, “Sep 08 2011” and click “Register” at the far right of the item.

Via Through the Interface

More details that probably will apply for this training:

Description

Want to get under the hood of the .NET API for AutoCAD®? If you wish to customize AutoCAD or develop applications on top of it—without having to learn C++ programming first—then this class is for you.

Audience

This course is designed for developers, distributors, resellers, and experienced users of AutoCAD software who would like to develop applications using the AutoCAD .NET API.

Prerequisites

Prior experience customizing AutoCAD is not required, but familiarity with the Visual Basic .NET or C# programming languages is expected. A basic understanding of the "end-user" functionality of AutoCAD is required.

Objectives

This class provides a detailed outline of the features associated with the AutoCAD .NET API. In addition to technical overviews presented by Autodesk experts, this course offers sample Visual Basic .NET/C# code and hands-on labs, as well as examples to get you started.

After attending this course, you will be able to

  • Understand the concepts and functions of the AutoCAD .NET API.
  • Understand the scope of the .NET API, and its relationship to the other AutoCAD APIs
  • Create applications using the AutoCAD .NET API
Contents
  • Overview of required .NET concepts.
  • AutoCAD .NET Visual Studio project settings.
  • User Interaction - custom commands, keywords, and selection sets.
  • Database fundamentals – Symbol tables, Transactions, Dictionaries etc .
  • Event handling – implementing and registering event handlers in AutoCAD .NET.
  • User Interface design - WinForms dialogs and AutoCAD palettes.
  • Application deployment and installation.

Training will be presented using Visual Basic .NET. Sample code will be provided in both Visual Basic .NET and C#.

Materials

Electronic tutorial materials, sample code and hands-on labs.

Note: Due to ongoing updates, content delivered during the class may differ from that described here.

Friday, June 10, 2011

.NET code problem on Windows Server 2003 solved

I spent several hours hunting down a problem a customer had with JTB FlexReport on Windows Server 2003 SP2. The solution was in the end a single row. Things worked fine on Windows XP, Windows Vista, Windows Server 2008, Windows Server 2008 SP2  and Windows 7, but for some reason it failed on Windows Server 2003.

In the code I narrowed down that this call failed but I could not figure out why:

Database db = DatabaseFactory.CreateDatabase();

I got this error using Microsoft Enterprise Library 2.0:

Object reference not set to an instance of an object.

I was wondering if it had to do with the Enterprise Library version but I got this error using Microsoft Enterprise Library 5.0:

Activation error occured while trying to get instance of type Database, key ""

I then wondered if the problem was that I had one .exe made by VB.NET and a DLL made by C#, or that it was running as a Windows Service, or that some code had been upgraded all the way from VB6 etc.

Eventually I was able to scale away a copy of my program to just a few rows and still had the problem. Then I created a similar program from scratch and got it running. I could then start to compare the two file by file using DiffMerge and eventually I was able to find that in app.manifest I had to add the following:

<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>

just before <trustInfo

Now that I found the solution I looked up more details and found that reading any configuration settings from the applications .config file is not working. I also found that it actually is due to a bug in Windows Server 2003. Calls to System.Configuration.ConfigurationManager.AppSettings return null. In Windows Server 2003, if the application has the following SxS manifest, then CLR will not use the application config file even if it exists. This bug does not exist in Windows XP, Windows Vista or Windows 7. Application config file is not used if the application has certain SxS manifest and Lesson Learned: Missing language attribute in ‘assemblyidentity’ element can cause SxS (SideBySide) application loading failure on Windows XP and Server 2003

Sunday, June 5, 2011

How to rename a registry key with .NET

Let’s say I have a registry key named “HKEY_CURRENT_USER\SOFTWARE\JTB World 1” and I want to rename it to “HKEY_CURRENT_USER\SOFTWARE\JTB World 2”. This is easily done in the Registry Editor (regedit.exe).

But neither Microsoft.Win32.Registry class nor .NET Framework My.Computer.Registry provide rename functionality.

One solution is using REG.EXE, copying the key and all subkeys and then delete the old key. No need to recursively copy keys as would be needed if using the Registry class.

Here is a VB.NET example that easily can be converted to for example C#, BAT/CMD/VBS (VBScript). No error checking added. WindowStyle is used to avoid seeing Windows command window showing.

Dim OldKey As String = "HKEY_CURRENT_USER\SOFTWARE\JTB World 1"
Dim NewKey As String = "HKEY_CURRENT_USER\SOFTWARE\JTB World 2"
Dim startInfo As New ProcessStartInfo("REG.EXE")
startInfo.WindowStyle = ProcessWindowStyle.Hidden
startInfo.Arguments = "COPY """ & OldKey & """ """ & NewKey & """ /s"
Dim myProcess As Process = Process.Start(startInfo)
myProcess.WaitForExit()
startInfo.Arguments = "DELETE """ & OldKey & """ /f"
Process.Start(startInfo)

Wednesday, April 20, 2011

AutoCAD 2012 and .NET Framework 4.0

.NET Framework 4.0 is required by applications like AutoCAD 2012, AutoCAD Architecture 2012, AutoCAD Civil 3D 2012, AutoCAD LT 2012, AutoCAD Map 3D 2012, AutoCAD Mechanical 2012, Autodesk 3ds Max 2012, Autodesk 3ds Max Design 2012, Autodesk Inventor 2012

Autodesk’s Knowledge Base TS16436702 provides more details:

Problem

Many of the Autodesk 2012 products require the installation of Microsoft .NET 4.0. In many cases .NET 4.0 will automatically be installed by the Autodesk 2012 installer however there are system-specific conditions where .NET cannot be installed by the Autodesk installer and will need to be installed manually.

This typically happens on systems running Windows XP without certain Windows updates or Vista and Windows 7 systems that are not up-to-date. In cases where a manual installation of .NET 4.0 is required, you will see the following alert dialog when you click the Install button to begin the the installation process:

Clicking the Update button will automatically terminate your Autodesk product installer and begin the .NET 4.0 installation.

Solution

To ensure that the Autodesk product installation is not interrupted by .NET 4.0 installation requirements, we strongly recommend manually installing Microsoft .NET 4.0 before beginning installation of your Autodesk 2012 product.

Note: This is especially important for systems that will be receiving an Autodesk 2012 product via silent installation of a deployment. Deployments will not check for .NET 4.0 and will not install if .NET 4.0 is not present on the system.

Microsoft .NET 4.0 is available on the Autodesk 2012 product media in the following location:

\3rdParty\NET\4\wcu\dotNetFramework\dotNetFx40_Full_x86_x64.exe

If you do not have access to the original Autodesk 2012 product media, you can download the Microsoft .NET 4.0 installer at the following location (refer to the Microsoft-supplied readme and documentation for additional information and prerequisites):

Microsoft .NET Framework 4 (Web Installer)

After .NET 4.0 has been installed, you must reboot your computer. You should perform this step even if you are not prompted to reboot. After your system has restarted, you can begin the installation of your Autodesk 2012 product.

Friday, April 1, 2011

Solution to System.IO.FileLoadException Could not load file or assembly error

I had a customer that downloaded a DLL to load in AutoCAD with NETLOAD having problem to get it work.
The solution to the error found at the bottom is to right click on the DLL file and click on Unblock button to the right of the text: This file came from another computer and might be blocked to help protect this computer.


If this does not work AlternateStreamView might work. Run it and delete all streams marked ":Zone.Identifier:$DATA" for the selected files (it might be .DLL, .ZIP, .EXE, .7z) to get rid of the security blocks.

Typical Error causing this problem found below:
Cannot load assembly. Error details: System.IO.FileLoadException: Could not
load file or assembly 'file:///C:\Users\JTB\AppData\Roaming\JTB
World\DimNotes\JTBDimNotes.dll' or one of its dependencies. Operation is not
supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Users\JTB\AppData\Roaming\JTB
World\DimNotes\JTBDimNotes.dll' ---> System.NotSupportedException: An attempt
was made to load an assembly from a network location which would have caused
the assembly to be sandboxed in previous versions of the .NET Framework. This
release of the .NET Framework does not enable CAS policy by default, so this
load may be dangerous. If this load is not intended to sandbox the assembly,
please enable the loadFromRemoteSources switch. See
http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String
codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint,
StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean
forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean
forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile,
Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm
hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks,
StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Autodesk.AutoCAD.Runtime.ExtensionLoader.Load(String fileName)
at loadmgd()

Wednesday, March 2, 2011

Style the Ribbon

The Building Coder shows some fun coding trix to put color and style to the Ribbon in AutoCAD and Revit.

Using the AdWindows.dll assembly, we can access the ribbon control like this:

using Autodesk.Windows;

RibbonControl ribbon = ComponentManager.Ribbon;

As seen below the panel background image, panel headers, tab header font and more can be changed.

Monday, February 7, 2011

Error 1001. The specified service has been marked for deletion

I’ve created an installer using a Visual Studio 2008 deployment project where I install and uninstall a Windows service using a custom action and run into this problem when reinstalling the program.

Error 1001. The specified service has been marked for deletion

Installation Incomplete: The installer interrupted before JTB FlexReport Core could be installed. You need to restart the installer to try again. Click "Close" to exit.

Restarting Windows helps but I wanted to avoid that.

I tried to use sc delete but that didn’t work. I found a tip that services.msc should be closed but I did not have it running. I tried to manually tweak the registry HKLM\SYSTEM\CurrentControlSet\Services but it did not help either.

It took a while to identify the problem but the solution was easy. Close or exit from Sysinternals Process Explorer and run the setup again. For some reason Process Explorer is locking the service process and causing this problem.

Wednesday, December 29, 2010

How to start a new process de-elevated after installation

I was trying to launch an application at the end of an installation I’ve created with Visual Studio. My problem was that the installation is running with elevated privileges as administrator (UAC) and I want the application to run as a normal user.

One problem with the application that was launched by the installer was that when reading and writing to the registry it ended up at HKEY_USERS\.DEFAULT instead of HKEY_CURRENT_USER. I noticed that the process was run by NT AUTHORITY\SYSTEM instead of the expected COMPUTERNAME\USERNAME. This will also cause problems if you want to open a webpage after the installation and there is no current Web Browser running.

I knew how to elevate the process using the verb runas.

p.StartInfo.UseShellExecute = true; p.StartInfo.Verb = "runas";

But I could not find any way to use the verb to de-elevate. I searched for a solution online but could only find convoluted ways like using CreateProcessAsUserW, Code Injection in the shell process or using the task scheduler to register a task to run as the currently logged on desktop user.

I found this post and tried using the User Account Control Helpers to no avail for some reason.

Process p = UacHelpers.UserAccountControl.CreateProcessAsStandardUser("notepad.exe", "");

Eventually I came up with this simple C# code thinking it might do the trick. It actually runs the new program with reduced permissions but not as the intended user. This could be useful in other situations though.

Process p = new Process(); p.StartInfo.FileName = "runas.exe"; p.StartInfo.WindowStyle = ProcessWindowStyle.Normal; p.StartInfo.Arguments = "/trustlevel:0x20000 notepad.exe"; p.Start();

Unfortunately it didn’t help me here.

I then turned back to the UacHelpers source code and commented out these rows because I noticed that the process was not really elevated from the start so I did not want the simple way to start the process.

//if (!IsCurrentProcessElevated) //{ // return Process::Start(exePath, arguments); //}

Using this trick it was possible to have an application like my setup that runs with administrator privileges (thanks to UAC) to start another process with standard user privileges and as the expected user.

For more details on the subject see also Aaron Margosis’ WebLog.

Please comment if this helps you or if you have any related suggestions on better approach.

Monday, December 20, 2010

Error 1001. InstallUtilLib.dll: Unknown error.

During uninstallation this error can show up: Error 1001. InstallUtilLib.dll: Unknown error.

The solution can be to installing a newer version of .NET Framework.

Thursday, December 16, 2010

Error 1001 The specified service does not exist as an installed service

If you run into this problem trying to uninstall an application that includes as service like JTB FlexReport this post might help.

Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However the application might not be fully uninstalled after the uninstall is complete. --> The specified service does not exist as an installed service

Still the uninstallation rolls back.

Try repair of the installation and then uninstall again.

Another workaround can be to manually install the service like this:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" "C:\Program Files\JTB World\JTB FlexReport\JTBFlexServ.exe"
alternatively depending on what .NET Framework version you have installed:
"C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe" "C:\Program Files\JTB World\JTB FlexReport\JTBFlexServ.exe"

Other indications of this problem can be seen in the Event Viewer.

“The description for Event ID 11001 from source MsiInstaller cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Product: JTB FlexReport Core Service -- Error 1001. Error 1001. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. --> The specified service does not exist as an installed service (NULL) (NULL) (NULL) (NULL) (NULL) the message resource is present but the message is not found in the string/message table”

Followed by this Information Event ID 11725: Product: JTB FlexReport Core Service -- Removal failed.

If uninstalling still fails try msizap. It's an unsupported utility that lets you browse and remove stuff from the MSI registry. It won't actually uninstall, just clean things up.
Search for MsiZap.exe on  http://www.microsoft.com or at http://msdn.microsoft.com/en-us/library/aa370523.aspx

See also Error 1001. The specified service already exists

Thursday, October 28, 2010

Asynchrony Await and the Async CTP

More Asynchrony in programming to look forward to. And for users it means more responsive and quicker applications.

Async CTP introduces a new keyword await, which indicates that the caller would like control to return when an asynchronous method call has completed. And the Async modifier does not create additional threads.

public async Task<int> SumPageSizesAsync(IList<Uri> uris) { int total = 0; foreach (var uri in uris) { statusText.Text = string.Format("Found {0} bytes ...", total); var data = await new WebClient().DownloadDataTaskAsync(uri); total += data.Length; } statusText.Text = string.Format("Found {0} bytes total", total); return total; }

Public Async Function SumPageSizesAsync(uris As IList(Of Uri)) As Task(Of Integer) Dim total As Integer = 0 For Each uri In uris statusText.Text = String.Format("Found {0} bytes ...", total) Dim data = Await New WebClient().DownloadDataTaskAsync(uri) total += data.Length Next statusText.Text = String.Format("Found {0} bytes total", total) Return total End Function

Making Asynchronous Programming Easy

Asynchrony in C# 5, Part One

Announcing the Async CTP for Visual Basic (and also Iterators!)

The async CTP homepage: http://msdn.com/vstudio/async

Tuesday, May 18, 2010

Access Database Engine Redistributable 2010

This is great news as it makes it possible to make add-in programs for example for AutoCAD 64-bit to access MS Access databases. Among JTB World’s software I plan on implementing this for ACAD_db and ACA_db. If there is a need for it JTB FlexReport could be supported as a native 64-bit application and still have the option to support MS Access databases, not sure if there is any pressing need for it though.

Formerly known as Office Connectivity Component, Access Database Engine 2010 is now available in both 32-bit and 64-bit. It is available in 9 languages. You can download it here.

This download will install a set of components that can be used by non-Microsoft Office applications to read data from and write data to Office 2010 system files such as Microsoft Access 2010 (mdb and accdb) files and Microsoft Excel 2010 (xls, xlsx, and xlsb) files.

  • If you are an application developer using OLEDB, set the Provider argument of the ConnectionString property to “Microsoft.ACE.OLEDB.14.0”
  • If you are connecting to Microsoft Office Excel data, add “Excel 14.0” to the Extended Properties of the OLEDB connection string.
  • If you are application developer using ODBC to connect to Microsoft Office Access data, set the Connection String to “Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path to mdb/accdb file”
  • If you are application developer using ODBC to connect to Microsoft Office Excel data, set the Connection String to “Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=path to xls/xlsx/xlsm/xlsb file”

Tuesday, May 11, 2010

Autodesk possible cross-product scripting language/IDE

This post has best before date of May 30th, 2010.

Autodesk is researching candidates for a possible cross-product scripting language/IDE. What is your preferred language?

  • Javascript/ECMAScript
  • Python
  • Ruby
  • Lua
  • VBA/VBScript

If you want to make your voice heard on this question and others take the survey for the product you work with.

AutoCAD®
AutoCAD® Civil 3D®
AutoCAD® Map 3D®
Revit®
Autodesk Inventor®
Autodesk Navisworks®

Via Through the Interface: API wishlist surveys for Autodesk products

Tuesday, December 22, 2009

Run-time error '429': ActiveX component can't create object solution for VBA 64-bit

Code like this will result in error in AutoCAD Architecture 2010 64-bit:
Set SchedApp = New AecScheduleApplication

Or this in AutoCAD 2010 64-bit:
Set SSM = New AcSmSheetSetMgr

One method that seems to work is to move the code from within a sub to the declaration like this:
Private SchedApp As New AecScheduleApplication

Another method is to replace it using GetInterfaceObject like this:
Set SchedApp = ThisDrawing.Application.GetInterfaceObject("AecX.AecScheduleApplication.6.0")

The reason is that VBA runs as an out-of-process client in 64-bit applications.

Unfortunately this also means that Sheet Set Manager API cannot be used in 64-bit applications because it is a COM server that cannot be called from another process as opposed to an ActiveX server.

Another 64-bit related problem is in AutoCAD Architecture 2009/2010 and AutoCAD MEP 2009/2010. In Tools>References the AutoCAD tlb shows up but not for the verticals. The same problem is also in .NET if you look at the COM tab when adding references.

The solution for this is a fix in the registry that look like this:

[HKEY_CLASSES_ROOT\TypeLib\{E8BCE300-BF69-431B-9153-1FF0DEF8F613}\6.0\0\win32]
@="C:\\Program Files\\Common Files\\Autodesk Shared\\AecXBase60.tlb"

It needs to be done for each tlb you want to use. There is a win64 key but the win32 key is missing so it needs to be added.

Here is also a Microsoft KB describing similar problems with Office.

Tuesday, August 18, 2009

AutoCAD 2010 .NET API: eFileSharingViolation in Database.SaveAs

See the details on the problem AutoCAD 2010 .NET API: eFileSharingViolation in Database.SaveAs that Nikolay Poleshchuk found.

That's why AutoCAD .NET Developer's Guide uses more reliable acDoc.Database.SaveAs(acDoc.Name, True, DwgVersion.Current, acDoc.Database.SecurityParameters) instead.


Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner