AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
*Expert Elite*
4,621 Posts
922 Kudos
Registered: ‎07-22-2003
Post 1 of 8

2013 Managed API bug - GetQuery()

225 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*
4,621 Posts
922 Kudos
Registered: ‎07-22-2003
Post 2 of 8

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*
4,621 Posts
922 Kudos
Registered: ‎07-22-2003
Post 3 of 8

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
543 Posts
26 Kudos
Registered: ‎06-09-2009
Post 4 of 8

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*
4,621 Posts
922 Kudos
Registered: ‎07-22-2003
Post 5 of 8

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
543 Posts
26 Kudos
Registered: ‎06-09-2009
Post 6 of 8

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*
4,621 Posts
922 Kudos
Registered: ‎07-22-2003
Post 7 of 8

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
543 Posts
26 Kudos
Registered: ‎06-09-2009
Post 8 of 8

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!