Revit API

Posts: 4
Registered: ‎10-16-2012
Message 1 of 4 (244 Views)

Unable to set reference point of DWGImportOptions in Revit 2012

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



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:



    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.




Chiou Hau

Distinguished Contributor
Posts: 111
Registered: ‎09-07-2012
Message 2 of 4 (237 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.





Posts: 4
Registered: ‎10-16-2012
Message 3 of 4 (226 Views)

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

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



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?



Chiou Hau

ADN Support Specialist
Posts: 123
Registered: ‎08-15-2007
Message 4 of 4 (87 Views)

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

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



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:


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


Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!