Revit API

Reply
Member
chiouhau
Posts: 4
Registered: ‎10-16-2012
Message 1 of 4 (237 Views)

Unable to set reference point of DWGImportOptions in Revit 2012

237 Views, 3 Replies
10-16-2012 01:36 AM

Hi,

 

When I try to set reference point using "DWGImportOptions.SetRefPoint" in Revit 2012, it throws InternalException at SetRefPoint saying that: "Attempt to read or write Protected Memory. This is often an indicating that other memory is corrupt.". Below is the minimal test case:

 

[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Automatic)]

    public class CreateFamilyFile : IExternalCommand

    {

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)

        {

            //parameter: DWGImportOptions

            DWGImportOptions dwgImportOptions = new DWGImportOptions();

            dwgImportOptions.SetRefPoint(new XYZ(0.0, 0.0, 0.0));

 

            return Result.Succeeded;

        }

 

Same test case is performed in Revit 2013 and it worked just fine. So I wonder whether is a bug in SDK or anything? Any helps would be much appreciated.

 

 

Thanks,

Chiou Hau

Valued Contributor
Revitalizer
Posts: 84
Registered: ‎09-07-2012
Message 2 of 4 (230 Views)

Re: Unable to set reference point of DWGImportOptions in Revit 2012

10-16-2012 04:32 AM in reply to: chiouhau

Dear chiouhau,

 

may it be that you have interchanged the referenced RevitAPI.dlls ?

Since you code both for 2012 and 2013, it may be that you have referenced the false one.

Running in 2013 but not in 2012 sounds like you try to use a 2013 addin with a 2012 Revit.

 

 

Cheers,

Revitalizer

Member
chiouhau
Posts: 4
Registered: ‎10-16-2012
Message 3 of 4 (219 Views)

Re: Unable to set reference point of DWGImportOptions in Revit 2012

10-17-2012 07:57 PM in reply to: chiouhau

Hi,

 

This error occured when I'm using RevitAPI.dll 2012 and run the add-in in Revit 2012. The weird part is it works fine for Revit 2013 add-in. Any ideas?

 

Regards,

Chiou Hau

ADN Support Specialist
gopinath.taget
Posts: 123
Registered: ‎08-15-2007
Message 4 of 4 (80 Views)

Re: Unable to set reference point of DWGImportOptions in Revit 2012

02-05-2014 05:21 PM in reply to: chiouhau

Hello,

 

I know this issue has remained unresolved for some time but I am responding to it because I see a similar question logged with Autodesk Developer Networks separately and here is my response to that:

 

*-----------

I did a little bit of research to see if this is a known issue but unfortunately, I do not see a lot of information about this issue.

 

It looks like you or one of your colleagues posted it a couple of years ago.

 

Without a reproducible sample, the only thing I can say is that the memory is already corrupt in the running instance of Revit by the time "dwgImportOptions.SetRefPoint" is run so either other portions of your application or some other application is not using memory properly.

 

Probably the first and easiest thing to do is to update to the latest service pack and see if it resolves the issue: http://usa.autodesk.com/adsk/servlet/ps/dl/index?siteID=123112&id=2334435&linkID=21208796#section3

 

If this does not help, please provide us with a minimal, buildable, non-confidential sample to reproduce the problem.

 

Sorry for not being more helpful.

*-----------

 

Best Regards

Gopinath

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.