AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add LayerGroup

0 REPLIES 0
Reply
Message 1 of 1
dan_nilsson
157 Views, 0 Replies

Add LayerGroup

Is it possible to add a layergroup in the Task Pane (Display Manager) with .Net code?
I have tried this code but I get an error when I use grp.add(...). Have also tried with grp.Insert(...) but also an error show up. What do I need to do more to get it to work properly?


If I save the dwg file, and then open it again, the layergroup is there and it works.

Public Sub MapCreateGroup(ByVal sGrp As String)
Dim currentMap As AcMapMap = AcMapMap.GetCurrentMap()
Dim sName As String = currentMap.Name
Dim grpcol As MgLayerGroupCollection = currentMap.GetLayerGroups()
If (Not grpcol.Contains(sGrp)) Then
Dim MgLayGroup As New MgLayerGroup(sGrp)
MgLayGroup.SetDisplayInLegend(True)
MgLayGroup.SetExpandInLegend(False)
MgLayGroup.SetLegendLabel(sGrp)
grpcol.Add(MgLayGroup)
End If
End Sub

Error: An unclassified exception occurred.

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report