3d Surface from 2d text height point

Hello

a long time ago (  few or more years ) as i remember - someone from us ( communities ) make a script  vba or something

to make a surface from  2d text  on map  (  for example  31.2 ,  32.4  etc ... )

Maybe someone remember this or can help ?  I need to make sufrace from points but there are 2d

As i remember this script put text on level from text and than connect it to mesh ?

Martin

Parents
  • For Mstn V8i users  I have  posted before a old bas macro (ExtractText ) that  will extract the xy and Text   of a 2d Text file and create a txt or csv file  you can then us import coordinates tool and this text file to create 3d points in an 3d file and then use the  3d tools  to create a surface from those points...  it  works off the  justification as the xyz location..

    So you  need to look at your file carefully to work out if the  white crosses are ( if the are not txt node markers) but are where  where you need the text to originate from, there is an mdl in the utilities section here that will change your  text justification without moving the text ( a really useful utility) , I would set the  justification to centre center then change all the text centre centre next  I would select all the  text and  move it  so the the text justification is  aligned with the survey  spot height crosses... then run the ExtractText.bas  to recreate the  spot height  survey coordinate text file...FYI you may need to edit the  bas or create the folder  for it to save it defaults is "C:\temp\ExtText.csv"

    If anybody would take on converting this very useful  bas into vba I'm sure we would all benefit.

    0116.ExtractText.zip

    Lorys

    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me 

  • Unknown said:
    run the ExtractText.bas  to recreate the  spot height  survey coordinate text file

    I examined the code in that macro.  It writes lines similar to 'nnn',1,2,3 where 1,2,3 is the text origin.  You still must do some work to convert 'nnn' to a number and substitute that for the Z coordinate.  In other words, it's no different to using the XYZ Text tool built-in to MicroStation.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • Unknown said:
    run the ExtractText.bas  to recreate the  spot height  survey coordinate text file

    I examined the code in that macro.  It writes lines similar to 'nnn',1,2,3 where 1,2,3 is the text origin.  You still must do some work to convert 'nnn' to a number and substitute that for the Z coordinate.  In other words, it's no different to using the XYZ Text tool built-in to MicroStation.

     
    Regards, Jon Summers
    LA Solutions

Children
  • Unknown said:

    I examined the code in that macro.  It writes lines similar to 'nnn',1,2,3 where 1,2,3 is the text origin.  You still must do some work to convert 'nnn' to a number and substitute that for the Z coordinate.  In other words, it's no different to using the XYZ Text tool built-in to MicroStation.

    I have used this macro for several years  ...... when  people have taken a 3d  spot height file and  converted to it to 2d txt ( it happens more often than you think)...the posters case in point....

    when I use the  macro  it copies all the text  origins and well as the text  itself to a csv file, then I open the export csv file  in excel

    it has the  format  T,X,Y,Z but all the z's = 0 ,  cut and paste the T column over the z column you now have real xyz values  to place  POINTS with...

    Now I use the xyz  coordianate import  tool it  can use the what is substituted  the text value as the  Z value,  without this macro and excel or advanced text editor  you cant  get the both the  text  and its  coord xy  into the xyz import tool... 

    Well I've never been able to import the Text value  with xyz tool and this macro allows us to, its  especially  easy if you have  excel to view and edit the export file..

    Now I'm not 100% sure if the macro uses the text true origin or its justification  I've always just make the text take on centre centre first and move all the text  it over the crosses and it all moves relative the same amount, I may be been just lucky the spot height crosses are usually close to the text origins..

    I have also used this macro to get the text coordianates and text  values of the the Z then used a cell to replace the 2d crosses with 3d crosses .. but I prefer the active points method as I can then use the create surface by 3d points ...

    When you cant retrieve the original 3d survey  or the get the surveyor to resupply this method is the next best approximation I can find especially if you dont have inroads and just msnt and msoffice...

    Lorys

    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me 

  • Thanks all !

    Andrew and Judy the problem is that i have only Microstation. Not Civil...

    Lorys and Jon - yes maybe this help . I attached the file. This text is on other layer.  When i test by hand - as i move the text on good height - not a probem to mesh from points. What about scale ? i need to change it before to meters

    Martin

    Site Plan 15.11.16.dwg

  • Hi Martin,

    Unknown said:
    a long time ago (  few or more years ) as i remember - someone from us ( communities ) make a script  vba or something

    It seems to be faster to write the code than to try to find the old one ;-)

    Public Sub MoveTexts()
    
    Dim levelWithText As Level
    Set levelWithText = ActiveDesignFile.Levels("Levels")
    
    Dim esc As New ElementScanCriteria
    esc.ExcludeAllLevels
    esc.IncludeLevel levelWithText
    
    esc.ExcludeAllTypes
    esc.IncludeType msdElementTypeText
    
    Dim ee As ElementEnumerator
    Set ee = ActiveModelReference.Scan(esc)
    
    Dim counter As Integer
    
    Do While ee.MoveNext
        Dim txt As TextElement
        Set txt = ee.Current.AsTextElement
        
        Dim txtValue As String
        txtValue = txt.Text
        
        ' Uncomment if , is used as decimal separator in your country
        'txtValue = Replace(txtValue, ".", ",")
        
        Dim txtValueAsNum As Double
        txtValueAsNum = CDbl(txtValue)
        
        ' Uncomment if a height conversion is required
        'txtValueAsNum = txtValueAsNum * 1000
        
        Dim moveVector As Point3d
        moveVector = Point3dFromXYZ(0, 0, txtValueAsNum)
        
        txt.Move moveVector
        txt.Rewrite
        
        counter = counter + 1
    Loop
    
    MsgBox "Moved text elements: " & CStr(counter)
    
    End Sub
    

    Macro is not optimized at all and written off hand, but it works. The result is attached.

    Unknown said:
    What about scale ? i need to change it before to meters

    Uncomment the line in the code and to multiply Z value depending on your needs.

    With regards,

      Jan

    Site Plan 15.11.16 with mesh.dwg

  • Unknown said:

    Hi Martin,

    It seems to be faster to write the code than to try to find the old one ;-)

    Uncomment the line in the code and to multiply Z value depending on your needs.

    Jan I tried  your  excellent code and it worked very  well  at  converting the  text to its true 3d value  but  I cant  place active points with the text as with only msnt available to me I want to make 3d points so I can create 3d meshes or 3d contours with the available msnt 3d  tools..

    When I use the the old basic  it exports the text  value and its 2d coords so I can then use the text  file  with the xyz import coordinates  tool...

    The perfect solution would be have the vba not just read and move 2d text to its new Z  but   to place an active  point at each text  3d text origin... then this could be used for creating 3d mesh... or contours etc ...

    Lorys

    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me 

  • Unknown said:
    The perfect solution would be have the vba not just read and move 2d text to its new Z  but   to place an active  point at each text  3d text origin

    Do you want both the text and an active point at the correct elevation?

    Unknown said:
    When I use the the old basic  it exports the text  value and its 2d coords

    How is that different to the XYZ tool in MicroStation?

     
    Regards, Jon Summers
    LA Solutions