AutoCAD Map 3D Developer
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Query with propertyal teration in .NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
217 Views, 1 Replies
04-25-2012 10:05 AM
Can someone provide an example or link on how to create a propertyalteration in a query using C# or VB?
I have found the ObjectARX example >>here<< but my C skills are very limited. If someone could tell me how to add that to >>this<< I will be forever in your debt.
I am to the point where I can query text objects from a layer, but I need to know how to put them on to a different layer ("TEST" for example).
Re: Query with propertyal teration in .NET
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
04-25-2012 10:43 AM in reply to:
fieldguy
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.ActiveProje ct
prjModel.Options.MarkObjectsForEditingWithoutPromp ting = 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.AlterationLay er)
propalterlayer.Expression = "TEST"
Dim propalterstyle As PropertyAlteration = Nothing
propalterstyle = propdef.AddAlteration(AlterationType.AlterationSty le)
propalterstyle.Expression = "STANDARD"
qryModel.EnablePropertyAlteration(True)
qryModel.Define(qryRoot)
Dim queriedobjids As ObjectIdCollection = qryModel.Execute(dwgset)
End SubThanks for >>this<< djonio!
