I should have waited. I found the answer in the Map SDK examples in SessionSampleCommand.cs.
<CommandMethod("q8")> _
Sub q_8()
Dim prjModel As ProjectModel = HostMapApplicationServices.Application.ActiveProject
prjModel.Options.MarkObjectsForEditingWithoutPrompting = True
Dim dwgset As DrawingSet = prjModel.DrawingSet
dwgset.AttachDrawing("some dwg file")
Dim qryModel As QueryModel = prjModel.CurQuery
qryModel.Mode = QueryType.QueryDraw
qryModel.Clear()
Dim qryRoot As QueryBranch = QueryBranch.Create()
'location
Dim loccond As LocationCondition = New LocationCondition()
loccond.LocationType = LocationType.LocationInside
Dim polypts As New Point3dCollection()
polypts.Add(New Point3d(p1x,p1y,p1z))
polypts.Add(New Point3d(p2x,p2y,p2z))
polypts.Add(New Point3d(p3x,p3y,p3z))
polypts.Add(New Point3d(p4x,p4y,p4z))
Dim qpoly As New PolygonBoundary(polypts)
loccond.Boundary = qpoly
Dim qblocation As QueryBranch = QueryBranch.Create()
qblocation.AppendOperand(loccond)
qryRoot.AppendOperand(qblocation)
'properties
Dim propcond As PropertyCondition = New PropertyCondition()
propcond.JoinOperator = JoinOperator.OperatorAnd
propcond.PropertyType = PropertyType.Layer
propcond.ConditionOperator = ConditionOperator.ConditionEqual
Dim thelayers As String = "CSV source layer names"
propcond.Value = thelayers
Dim qbproperty As QueryBranch = QueryBranch.Create()
qbproperty.AppendOperand(propcond)
qryRoot.AppendOperand(qbproperty)
'
Dim prop2 As PropertyCondition = New PropertyCondition()
prop2.JoinOperator = JoinOperator.OperatorAnd
prop2.PropertyType = PropertyType.EntityType
prop2.ConditionOperator = ConditionOperator.ConditionEqual
prop2.Value = "TEXT"
Dim qbprop2 As QueryBranch = QueryBranch.Create()
qbprop2.AppendOperand(prop2)
qryRoot.AppendOperand(qbprop2)
'alter prop
Dim propdef As PropertyAlterationDefinition = qryModel.PropertyAlteration
Dim propalterlayer As PropertyAlteration = Nothing
propalterlayer = propdef.AddAlteration(AlterationType.AlterationLayer)
propalterlayer.Expression = "TEST"
Dim propalterstyle As PropertyAlteration = Nothing
propalterstyle = propdef.AddAlteration(AlterationType.AlterationStyle)
propalterstyle.Expression = "STANDARD"
qryModel.EnablePropertyAlteration(True)
qryModel.Define(qryRoot)
Dim queriedobjids As ObjectIdCollection = qryModel.Execute(dwgset)
End Sub
Thanks for >>this<< djonio!