I've been stalled on this for some time...
I'm trying to use the UDP names in the string query of CustomPointGroupQuery.
code snippet:
If Not cDwg.PointUDPClassifications.Contains(sSoilClassification) Then
cls = cDwg.PointUDPClassifications.Add(sSoilClassification)
**** = New dbCivil.AttributeTypeInfoString("Title")
loc = New dbCivil.AttributeTypeInfoString("Location")
typ = New dbCivil.AttributeTypeInfoString("HoleType")
tts = cls.CreateUDP(****) : tts.UseDefaultValue = False
locs = cls.CreateUDP(loc) : locs.UseDefaultValue = False
typs = cls.CreateUDP(typ) : typs.UseDefaultValue = False
pGrp.UseCustomClassification(cls)
End If
this part is ok to assign UDP's on point entities:
If Not tts Is Nothing Then p1.SetUDPValue(tts, sTitle)
If Not locs Is Nothing Then p1.SetUDPValue(locs, sLocation)
If Not typs Is Nothing Then p1.SetUDPValue(typs, sHolType)
Then....
Dim qry As New dbCivil.CustomPointGroupQuery()
If cDwg.PointGroups.Contains(sGrpName) Then
idGrp = cDwg.PointGroups.Item(sGrpName)
pgrp = DirectCast(tr.GetObject(idGrp, OpenMode.ForWrite), dbCivil.PointGroup)
pgrp.Description = sBHtype & " - " & sTitle
qry.UseCaseSensitiveMatch = False
--->below is where it crashes “PointGroupQueryParserException: Unsupported property name found”
qry.QueryString = "(Title='" & sTitle & "' AND HoleType='" & sBHtype & "')"
pgrp.SetQuery(qry)
End If
The funny thing is,
1) i was able to apply the UDP Classiffication on the PointGroups - programmatically ok
2) then i manually apply the query to Point Groups, using the 'Query Builder' tab and checking the 'Modify query' checkbox, i can actually see the UDP names that were created programmatically.
3) I then used debug mode, stepped thru the codes and Strangely, the qry.QueryString is returned to be:
"(='BOREHOLE' AND ='Drilling Project')"
Now that is really strange! I was able to manually use the UDP names in the Query Builder, but they now appear to be String.Empty ??
Am I missing something or could this be a Bug ?
Thanks if someone could help on this...
Efren Abella
Golder Associates Ltd
Canada
Try to open point group property window and manually create query with UDP in query builder. Then open summary tab and you will see that UDP property name is composed by GUID and "normally" property name.
For example: ef2c18f8693041af8cc82ea08b4b2b47Title = TestTitle.
Standard property names like "Point Number" is shown without GUID prefix. I try to put GUID.tostring("N") before property name in your code example, but without success. Try to play around with GUID and UDP name, maybe is this solution.
p.s.
You can get GUID of udp property by:
Dim classification As UDPClassification = classifications.Item("YourClassification")
Dim udp As UDPString = TryCast(classification.UDPs("Title").GetValue(0), UDPString)
Dim guid As String = udp.Guid.ToString("N")
zrobert, thanks for your response.
sorry it does not work using the guid or guid+"Title" either way.
and still the CustomPointGroupQuery.Query string returns empty, even from manually created point query.
I stepped thru the code and gives me empty name:
"(='Drilling Project')"
instead of:
"(Title='Drilling Project')"
Any help out there would be appreciated...
Exactly...this is what's happening..
I'm beginning to be inclined to believe this could be a Bug?
Unless there might be a pre-requisite instantiation that we're missing here.
I hope this gets attention of Partha Sarkar from Autodesk...
Efren
Hi,
It seems Civil 3D .NET API doesn't support the UDP property names in CustomPointGroupQuery.
I have logged an API wish list for the same to resolve this in future release of Civil 3D.
Thanks,