vb.net - Topobase - draw area of display-model

vb.net - Topobase - draw area of display-model

jan_tappenbeck
Collaborator Collaborator
851 Views
2 Replies
Message 1 of 3

vb.net - Topobase - draw area of display-model

jan_tappenbeck
Collaborator
Collaborator

hi!

 

i want to draw displaymodels of topobase-data and create following code base on agu-Deutschland help.

 

    Public Sub DrawDM(Document As Autodesk.Map.IM.Forms.Document, Optional ByVal Silent As Boolean = True)
        Dim DM_Name As String = "O:\Map2015-Darstellungsmodelle\ALKIS 20170125\ALKIS für DWG.tbdm"
        Dim Msg As String = ""
        Dim acDocMgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager
        Dim acDoc As Autodesk.AutoCAD.ApplicationServices.Document = acDocMgr.MdiActiveDocument

        If System.IO.File.Exists(DM_Name) = False Then
            If Silent = False Then
                MsgBox("Darstellungsmodell nicht gefunden!", MsgBoxStyle.Critical, k_AppName_Vermessung)
            End If
            Exit Sub
        End If

        If IsNothing(Document) Then
            If Silent = False Then
                MsgBox("Es ist kein Dokument zugewiesen!", MsgBoxStyle.Critical, k_AppName_Vermessung)
            End If
            Exit Sub
        End If

        Dim graphicsGenerator As Autodesk.Map.IM.Display.GraphicsGeneration.IGraphicsGenerator
        Try
            graphicsGenerator = Document.Application.Services.GetService(Of Autodesk.Map.IM.Display.GraphicsGeneration.IGraphicsGenerator)()

            'Bildaufbau


            Dim displayRepository As Autodesk.Map.IM.Display.DisplayModelManagement.IDisplayModelRepository
            displayRepository = graphicsGenerator.DisplayModelRepository

            Dim RepositoryPath As String
            RepositoryPath = graphicsGenerator.DisplayModelRepository.RepositoryDirectory.ToString()


            graphicsGenerator.DisplayModel = displayRepository.Load(DM_Name)
            'graphicsGenerator.DisplayModel = displayRepository.Load(RepositoryPath + "\" + "MeinDarstellungsmodell.tbdm")

            graphicsGenerator.ShowProgressBar = True

            Dim mydocuments As System.Collections.Generic.ICollection(Of Autodesk.Map.IM.Display.GraphicsGeneration.IDocument)

            'acDoc As Autodesk.AutoCAD.ApplicationServices.Document
            Dim docLock As DocumentLock = acDoc.LockDocument
            Using docLock
                mydocuments = graphicsGenerator.Draw
            End Using
        Catch ex As Exception
            Dim TryReport As New EBL.Service.TryCatchReport
            TryReport.Show("unerwarteter Fehler in EBL.Import.SielVerm > VermSielPunktImport", ex.ToString)
        Finally
            graphicsGenerator.ShowProgressBar = False
        End Try

    End Sub

 

in this code the complete area will draw.

 

question 1:

is there a way to define a area to draw like the Topobase function in the Dialog?

 

dm_20170718.png

 

question 2:

the draw process in dwg1 is ok

when i open a secound dwg (dwg2) the dwg-title will show dwg1 and it looks like the data will Import to dwg1 - but finally the data are correct into dwg2 draw.

 

did you have a idea of reason for this phänomen?

 

reagards Jan

0 Likes
Accepted solutions (1)
852 Views
2 Replies
Replies (2)
Message 2 of 3

drewbb
Enthusiast
Enthusiast
Accepted solution

It's probably best to post Topobase questions in the Map Developer forum.  Use IFilterSetter to apply a geometry filter (c# but hopefully you will get the general idea):

 

IFilterSetter filterSetter = FilterSetterFactory.Create(gg.DisplayModel);
filterSetter.OnlyOnTopobaseLayers = false;
filterSetter.TransformCoordSysInFilter = true;

var polygon = new Polygon
         {
             new LinePoint(extents2d.MinPoint.X, extents2d.MinPoint.Y),
             new LinePoint(extents2d.MaxPoint.X, extents2d.MinPoint.Y),
             new LinePoint(extents2d.MaxPoint.X, extents2d.MaxPoint.Y),
             new LinePoint(extents2d.MinPoint.X, extents2d.MaxPoint.Y),
             new LinePoint(extents2d.MinPoint.X, extents2d.MinPoint.Y)
         };

filterSetter.ApplyViewport(polygon);

 

Sincerely,
Drew Burgasser, P.E.
CAD Masters, Inc.
www.cadmasters.com
Message 3 of 3

jan_tappenbeck
Collaborator
Collaborator
0 Likes