
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am unable to get a Property Alteration of type AlterationType.AlterationLineWeight to work in .NET (C#). Has anyone been successful with this specific alteration?
I am able to complete a lineweight alteration manually in the Map Explorer, and I am able to complete an AlterationType.AlterationLayer programmatically. Using similar code for LineWeight fails, unforunately. I've tried entering "0","0.00" and "0.00 mm" as values for the LineWeight Expression but the alteration does not occur. If I add the "mm" suffix as it shows when I complete the alteration in the Map Explorer, it throws an error, as it must be a number, apparently. The layers are imported, just the lineweight isn't modified. I tried QueryModel.Execute and QueryModel.Run with the same result. The code I'm using is below:
// Attach the DWG ProjectModel pm = HostMapApplicationServices.Application.ActiveProject; ProjectCollection pc = HostMapApplicationServices.Application.Projects; DrawingSet ds = pm.DrawingSet; AttachedDrawing attachDWG = ds.AttachDrawing(_tempPath); QueryModel qm = pm.CreateQuery(); qm.Clear(); // Create the location condition LocationCondition condLoc = new LocationCondition(); condLoc.Boundary = AllBoundary.Create(); QueryBranch qbLocation = QueryBranch.Create(); qbLocation.JoinOperator = JoinOperator.OperatorAnd; qbLocation.AppendOperand(condLoc); // Alter the lineweight to 0 PropertyAlterationDefinition paDef = qm.PropertyAlteration; PropertyAlteration paLW = paDef.AddAlteration(AlterationType.AlterationLineWeight); paLW.Expression = "0"; qm.EnablePropertyAlteration(true); // Run the query qm.Define(qbLocation); qm.Mode = QueryType.QueryDraw; qm.Run(); //ObjectIdCollection idCol=qm.Execute(ds); //Same Result // Detach the DWG ds.DetachDrawing(attachDWG.AliasPath); qm.Clear();
If anyone has a LineWeight alteration working, I'd appreciate any insight you can provide. Thanks!
Solved! Go to Solution.