AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VB.NET Map Query

2 REPLIES 2
Reply
Message 1 of 3
ced_abitat
845 Views, 2 Replies

VB.NET Map Query

Hi All,

  I have a problem with VB.NET and Map using ActiveX interface.

I have an error when I try to add a new condition to QueryBranch

Ex

 

Dim objQB As AutocadMAP.QueryBranch = objQuery.QueryBranch
Dim objPCond As Object = objQB.Add(EClassId.kQueryBranch, EJoinOperator.kOperatorAnd) 
The same code in VB6 work fine!!!
Can you help me?
Regards
Matteo

 

2 REPLIES 2
Message 2 of 3
Partha.Sarkar
in reply to: ced_abitat

Hi Matteo,

 

Check if the following approach resolves this issue ?

 

<code_begin>

 

Public Function TestDefQuery()
Dim mapApi As Autodesk.Gis.Map.MapApplication
mapApi = MAP.HostMapApplicationServices.Application

Dim project As PROJECT.ProjectModel
project = mapApi.ActiveProject


'create location condition
Dim JointOp As New MAPCONSTANTS.JoinOperator()
Dim locationType As New MAPCONSTANTS.LocationType()
'Dim qryCondition As MAPQUERY.LocationCondition = New MAPQUERY.LocationCondition(JointOp.OperatorAnd, locationType.LocationInside)
Dim qryCondition As MAPQUERY.LocationCondition = New MAPQUERY.LocationCondition(JointOp.OperatorAnd)
Dim allBdry As MAPQUERY.AllBoundary
allBdry = maputil.NewAllBoundary()
qryCondition.Boundary = allBdry


'create branch
Dim qryBranch As New MAPQUERY.QueryBranch(JointOp.OperatorAnd)
qryBranch.AppendOperand(qryCondition)

 

End Function

 

<code_end>

 

Thanks,

 

Partha Sarkar
Autodesk Developer Network



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Message 3 of 3
dohenry
in reply to: Partha.Sarkar

Hi,

 

I just tried out this code and it works well.

 

However I was getting an error in the following line 

 

allBdry = maputil.NewAllBoundary()

 

I changed it to

 

allBdry = project.MapUtility.NewAllBoundary

 

and it resolve the error.

 

Donagh

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost