The issue is that I the contours I have came from a .shp file and the line elevations are not being stored as elevations. Instead they are being stored as string values in a property called "ELEVATION". I have tried many different ways to get these come in with elevation so I can create a surface, but so far with no luck. I was thinking that I could write a macro to get each line in my selection and pull the value from the property and set it as the line elevation.
What I have so far:
Public Sub ImportElevations()Dim oElEnum As ElementEnumeratorDim oEl As LineElementDim oPropHand As PropertyHandlerDim getElevationFromCustom As String
Set oElEnum = ActiveModelReference.GetSelectedElementsoElEnum.ResetWhile oElEnum.MoveNext Set oEl = oElEnum.Current Set oPropHand = CreatePropertyHandler(oElEnum.Current) If (oPropHand.SelectByAccessString("ELEVATION")) Then getElevationFromCustom = oPropHand.GetDisplayString ' Write getElevationFromCustom to line elevation End IfWend oEl.Redraw msdDrawingModeNormal oEl.RewriteEnd Sub
Has anyone dealt with this before?
Thanks,
Matt
When dealing with MicroStation based applications and Element attributes/properties it is best to include a very simple design file having one (1) element (more only if necessary) to allow the programmers to review the element and its associated data and format that it is stored in. There are several ways to get/set element data and a sample will save a lot of time and effort trying to identify what format the data is stored in. Please feel free to post a sample so the community can review it and make a prompt recommmendation.
Thank you,
Bob
Here is a simple .dgn with a single line string in it. All I want to do is take the [ELEVATION] Property and convert it to a double and use it as the Z elevation of the contour line. I think my code is close, but I cant find any information on the parameter for elevation.
~Matt
Hi Matt,
I have two question before an investiagation your code:
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Jan,
You are correct the source is a .shp file. I am unfamiliar with that variable. Can you explain this a little further?
I just read http://communities.bentley.com/products/road___site_design/f/5922/p/78214/214008.aspx and it would lead me to think that you can change the elevation of each point along the line segment of the element to from the elevation set in the property. i.e.
MS_ELEVPROP_AS_Z=ELEVATION.
How exactly would I implement this? I previously used the Bentley Map to set the elevation of each line the the elevation property and create labels. I was able to create a dtm from the text labels using GEOPAK, but the contours are not nearly as clean as the starting point.
MS_ELEVPROP_AS_Z is MicroStation configuration variable, which as far as I know works with SHP reference/import only and its usage is quite simple.
The workflow is:
I have not tested it, but I think you don't have close design file or to restart MicroStation after the variable is set, I think MicroStation checks for the variable setting every time SHP file is referenced or imported.
Answer Verified By: maat7043
Matt,
The ELEVATION element properties value you provided within the sample .dgn file can be get and set the property without any problems. Presuming that you are not encountering any problem in doing so, to set an element's elevation (z depth points) you may want to refer to the MicroStation VBA Help file topic: "Flattening Elements" that provides some sample code to "flatten" an element to the current view depth setting.
If Jan's suggestion does not help with your specific workflow/goal's end results maybe you could provide some additional details describing what your overall workflow would be. And let us know if the goal is to modify elements elevation directly in the .shp file/project or creating elements at a desired elevation stored in a seperate output .dgn file having no further requirements to synchronize with the original .shp file/project elements.