AutoCAD Civil 3D Customization

Reply
*Expert Elite*
Jeff_M
Posts: 4,193
Registered: ‎07-22-2003
Message 1 of 8 (211 Views)

2013 Managed API bug - GetQuery()

211 Views, 7 Replies
07-03-2012 02:15 PM

Trying to port some older COM code to use the new managed API in C3D2013. If I use code like so:

StandardPointGroupQuery query = pg.GetQuery();
query.IncludeNumbers = "2,3,5,7";
pg.SetQuery(query);

 Then if the PointGroup was already set to include at least 1 other point group, all is good. However, if the Point Group was set to NOT use other point groups you get an exception thrown with the message "The specified Point Group does not exist or is invalid".

 

It took some looking, but I found that the GetQuery() returns a query with 1 point group named "" when there are none set, thereby causing the subsequent error. If you just construct a new StandardPointGroupQuery object, no pg is added so no error is thrown (which is why the sample code on Isaac's page works without error). This can be worked around, but it really shouldn't need to be.

 

7-3-2012 2-13-43 PM.png

Jeff_M, also a frequent Swamper
*Expert Elite*
Jeff_M
Posts: 4,193
Registered: ‎07-22-2003
Message 2 of 8 (210 Views)

Re: 2013 Managed API bug - GetQuery()

07-03-2012 02:25 PM in reply to: Jeff_M

And this is the workaround:

            StandardPointGroupQuery query = (StandardPointGroupQuery)pgroup.GetQuery();
            //added to fix bug in initial release of C3D2013
            if (query.PointGroups.Count == 1 && query.PointGroups[0].Equals(""))
                query.PointGroups.Clear();

 

Jeff_M, also a frequent Swamper
*Expert Elite*
Jeff_M
Posts: 4,193
Registered: ‎07-22-2003
Message 3 of 8 (103 Views)

Re: 2013 Managed API bug - GetQuery()

09-24-2013 11:36 AM in reply to: Jeff_M

Just bringing this back to get some attention as it is really a PITA to have to use my cleanup method everytime I use GetQuery().

Jeff_M, also a frequent Swamper
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 4 of 8 (92 Views)

Re: 2013 Managed API bug - GetQuery()

09-25-2013 02:51 AM in reply to: Jeff_M

Jeff -

 

I will take a look at it and check the status in 2014.

 

Thanks,

Partha Sarkar



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Jeff_M
Posts: 4,193
Registered: ‎07-22-2003
Message 5 of 8 (86 Views)

Re: 2013 Managed API bug - GetQuery()

09-25-2013 05:45 AM in reply to: Partha.Sarkar

Thanks, Partha. I should have noted that the same behavior exists in C3D2014.

Jeff_M, also a frequent Swamper
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 6 of 8 (78 Views)

Re: 2013 Managed API bug - GetQuery()

09-25-2013 07:22 AM in reply to: Jeff_M

Jeff -

 

Was it reported earlier ? Is there any Change Request ID given to you againt this issue ?

 

 

Thanks,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Jeff_M
Posts: 4,193
Registered: ‎07-22-2003
Message 7 of 8 (70 Views)

Re: 2013 Managed API bug - GetQuery()

09-25-2013 07:30 AM in reply to: Partha.Sarkar

I've only reported here, Partha. No, no change request has been made as far as I know.

 

I thought I had made a comment about this on your post showing how to use SetQuery on the DevBlog (July 5, 2012) but I don't see any comments now. Strange thing is this thread was started 2 days prior to your blog post, maybe I thought you had seen this which prompted your post.

Jeff_M, also a frequent Swamper
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 8 of 8 (66 Views)

Re: 2013 Managed API bug - GetQuery()

09-25-2013 07:38 AM in reply to: Jeff_M

I will log a change request and follow it up to fix it soon.

 

Thanks,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

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 to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs