POST
|
Below is sample code which i have convert to c# which help us to generate Schematic Diagram On Web... for more help contact on sandeep.midgule@gmail.com Option Explicit Implements ICommand Dim m_pApp As IApplication 'ArcMap application Dim m_pBitmap As IPictureDisp 'Bitmap for the command Dim m_pCursor As IPictureDisp 'Cursor for the command Dim pMxDoc As IMxDocument 'ArcMap document Dim pMap As IMap ' Map Private Sub Class_Initialize() 'Load the button image and cursor from the resource file. Set m_pBitmap = LoadResPicture(101, 0) End Sub Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE ' Set the bitmap of the command. The m_pBitmap variable is set in Class_Initialize. ICommand_Bitmap = m_pBitmap End Property Private Property Get ICommand_Caption() As String ' String that appears when the command is used as a menu item. ICommand_Caption = "Generate Diagram From Selection" End Property Private Property Get ICommand_Category() As String ' Category of this command. ' This determines where the command appears in the Commands panel of the Customize dialog. ICommand_Category = "Custom Schematic Commands" End Property Private Property Get ICommand_Checked() As Boolean End Property Private Property Get ICommand_Enabled() As Boolean Dim pSchematicLayer As ISchematicLayer Dim pSchNgWrkMgr As ISchematicProjectMgr Dim pEnumLayer As IEnumLayer Dim pLayer As ILayer Dim pEnumFeature As IEnumFeature Dim pFeature As IFeature ' By default, the command is disabled ICommand_Enabled = False ' The command will be enabled only when a selection set is highlighted in the map Set pMxDoc = m_pApp.Document Set pMap = pMxDoc.FocusMap Set pEnumFeature = pMap.FeatureSelection Set pFeature = pEnumFeature.Next If Not pFeature Is Nothing Then ICommand_Enabled = True End If End Property Private Property Get ICommand_HelpContextID() As Long End Property Private Property Get ICommand_HelpFile() As String End Property Private Property Get ICommand_Message() As String 'Message string that appears in the statusbar of the application when the mouse passes over the command. ICommand_Message = "Generate Diagram from Selection Set" End Property Private Property Get ICommand_Name() As String 'Internal name of this command. By convention, this name string contains the category and caption of the command. ICommand_Name = "CustomSchematicCommands_GenerateDiagramFromSelection" End Property Private Sub ICommand_OnClick() Dim pGxDialog As IGxDialog Dim pFilterSchDatasets As IGxObjectFilter Dim pFilterCol As IGxObjectFilterCollection Dim pEnumGx As IEnumGxObject Dim pGxDataset As IGxDataset Dim pServerContext As IServerContext Dim pSchematicDataset As ISchematicDataset Dim pSchDiagramClass As ISchematicDiagramClass Dim pSchDiagramClassContainer As ISchematicDiagramClassContainer Dim pSchStandardBuilder As ISchematicStandardBuilder Dim pSchBuilderCtxt As ISchematicBuilderContext Dim pSchStandardBuilderCtxt As ISchematicStandardBuilderContext Dim pSchBuilder As ISchematicBuilder Dim pSchBuilderProps As ISchematicBuilderProps Dim pPropertySet As IPropertySet Dim pSchBuilderDesc As ISchematicBuilderDescription Dim pEnumFeature As IEnumFeature Dim pEnumObject As IEnumObject Dim pFeature As IFeature Dim pObject As IObject Dim pUID As UID Dim pSchematicEnumObject As EnumSchematicObject Dim DiagramName As String Dim pSchematicDiagram As ISchematicDiagram Dim pSchematicLayer As ISchematicLayer Dim pLayer As ILayer On Error Resume Next ' Getting the selected objects Set pMxDoc = m_pApp.Document Set pMap = pMxDoc.FocusMap Set pEnumFeature = pMap.FeatureSelection Set pSchematicEnumObject = New EnumSchematicObject pSchematicEnumObject.Initialize pEnumFeature ' Opening a GxDialog so the user selects the schematic dataset Set pFilterSchDatasets = New GxFilterSchematicDatasets Set pGxDialog = New GxDialog Set pFilterCol = pGxDialog pFilterCol.AddFilter pFilterSchDatasets, True pGxDialog.Title = "Select Schematic dataset" If Not pGxDialog.DoModalOpen(0, pEnumGx) Then Exit Sub End If ' Getting the selected schematic dataset Set pGxDataset = pEnumGx.Next Set pSchematicDataset = pGxDataset.Dataset ' Checking the diagram class existence in the selected schematic dataset Set pSchDiagramClassContainer = pSchematicDataset Set pSchDiagramClass = pSchDiagramClassContainer.SchematicDiagramClassByName(MyNewDiagramClassName) ' When the diagram class doesn't already exist, the CreateSchematicDiagramClass method is used to create it If pSchDiagramClass Is Nothing Then Set pSchDiagramClass = pSchematicDataset.CreateSchematicDiagramClass(MyNewDiagramClassName, Nothing, Nothing, Nothing, "") ' Then, a new instance of the SchematicStandardBuilder class is created Set pSchStandardBuilder = CreateObject("esriSchematic.SchematicStandardBuilder") ' The properties for this new builder are specified pSchStandardBuilder.AutoCreateElementClasses = True pSchStandardBuilder.InitializeLinksVertices = True pSchStandardBuilder.AddConnectedNodes = True Set pSchBuilder = pSchStandardBuilder Set pSchBuilderProps = pSchBuilder Set pSchBuilderDesc = pSchBuilder Set pPropertySet = pSchBuilderProps.PropertySet Set pUID = pSchBuilderDesc.ClassID ' The newly created builder is associated with the new diagram class pSchDiagramClass.AlterBuilder pUID, pPropertySet End If ' Getting the context that will be used to build the diagram Set pSchStandardBuilderCtxt = CreateObject("esriSchematic.SchematicStandardBuilderContext") Set pSchStandardBuilderCtxt.InitialObjects = pSchematicEnumObject ' Generating the diagram DiagramName = "Diagram_" & pSchDiagramClass.SchematicDiagrams.Count + 1 Set pSchematicDiagram = pSchDiagramClass.SchematicBuilder.GenerateDiagram(DiagramName, , , pSchStandardBuilderCtxt) ' Displaying the diagram Set pSchematicLayer = New SchematicLayer Set pSchematicLayer.SchematicDiagram = pSchematicDiagram Set pLayer = pSchematicLayer pLayer.Name = DiagramName pMap.AddLayer pLayer Err.Clear End Sub Private Sub ICommand_OnCreate(ByVal hook As Object) Set m_pApp = hook End Sub Private Property Get ICommand_Tooltip() As String 'String that appears in the screen tip. ICommand_Tooltip = "Generate Diagram From Selection" End Property
... View more
01-07-2011
08:39 PM
|
0
|
0
|
591
|
POST
|
Below is sample code which i have convert to c# which help us to generate Schematic Diagram On Web... for more help contact on sandeep.midgule@gmail.com Option Explicit Implements ICommand Dim m_pApp As IApplication 'ArcMap application Dim m_pBitmap As IPictureDisp 'Bitmap for the command Dim m_pCursor As IPictureDisp 'Cursor for the command Dim pMxDoc As IMxDocument 'ArcMap document Dim pMap As IMap ' Map Private Sub Class_Initialize() 'Load the button image and cursor from the resource file. Set m_pBitmap = LoadResPicture(101, 0) End Sub Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE ' Set the bitmap of the command. The m_pBitmap variable is set in Class_Initialize. ICommand_Bitmap = m_pBitmap End Property Private Property Get ICommand_Caption() As String ' String that appears when the command is used as a menu item. ICommand_Caption = "Generate Diagram From Selection" End Property Private Property Get ICommand_Category() As String ' Category of this command. ' This determines where the command appears in the Commands panel of the Customize dialog. ICommand_Category = "Custom Schematic Commands" End Property Private Property Get ICommand_Checked() As Boolean End Property Private Property Get ICommand_Enabled() As Boolean Dim pSchematicLayer As ISchematicLayer Dim pSchNgWrkMgr As ISchematicProjectMgr Dim pEnumLayer As IEnumLayer Dim pLayer As ILayer Dim pEnumFeature As IEnumFeature Dim pFeature As IFeature ' By default, the command is disabled ICommand_Enabled = False ' The command will be enabled only when a selection set is highlighted in the map Set pMxDoc = m_pApp.Document Set pMap = pMxDoc.FocusMap Set pEnumFeature = pMap.FeatureSelection Set pFeature = pEnumFeature.Next If Not pFeature Is Nothing Then ICommand_Enabled = True End If End Property Private Property Get ICommand_HelpContextID() As Long End Property Private Property Get ICommand_HelpFile() As String End Property Private Property Get ICommand_Message() As String 'Message string that appears in the statusbar of the application when the mouse passes over the command. ICommand_Message = "Generate Diagram from Selection Set" End Property Private Property Get ICommand_Name() As String 'Internal name of this command. By convention, this name string contains the category and caption of the command. ICommand_Name = "CustomSchematicCommands_GenerateDiagramFromSelection" End Property Private Sub ICommand_OnClick() Dim pGxDialog As IGxDialog Dim pFilterSchDatasets As IGxObjectFilter Dim pFilterCol As IGxObjectFilterCollection Dim pEnumGx As IEnumGxObject Dim pGxDataset As IGxDataset Dim pServerContext As IServerContext Dim pSchematicDataset As ISchematicDataset Dim pSchDiagramClass As ISchematicDiagramClass Dim pSchDiagramClassContainer As ISchematicDiagramClassContainer Dim pSchStandardBuilder As ISchematicStandardBuilder Dim pSchBuilderCtxt As ISchematicBuilderContext Dim pSchStandardBuilderCtxt As ISchematicStandardBuilderContext Dim pSchBuilder As ISchematicBuilder Dim pSchBuilderProps As ISchematicBuilderProps Dim pPropertySet As IPropertySet Dim pSchBuilderDesc As ISchematicBuilderDescription Dim pEnumFeature As IEnumFeature Dim pEnumObject As IEnumObject Dim pFeature As IFeature Dim pObject As IObject Dim pUID As UID Dim pSchematicEnumObject As EnumSchematicObject Dim DiagramName As String Dim pSchematicDiagram As ISchematicDiagram Dim pSchematicLayer As ISchematicLayer Dim pLayer As ILayer On Error Resume Next ' Getting the selected objects Set pMxDoc = m_pApp.Document Set pMap = pMxDoc.FocusMap Set pEnumFeature = pMap.FeatureSelection Set pSchematicEnumObject = New EnumSchematicObject pSchematicEnumObject.Initialize pEnumFeature ' Opening a GxDialog so the user selects the schematic dataset Set pFilterSchDatasets = New GxFilterSchematicDatasets Set pGxDialog = New GxDialog Set pFilterCol = pGxDialog pFilterCol.AddFilter pFilterSchDatasets, True pGxDialog.Title = "Select Schematic dataset" If Not pGxDialog.DoModalOpen(0, pEnumGx) Then Exit Sub End If ' Getting the selected schematic dataset Set pGxDataset = pEnumGx.Next Set pSchematicDataset = pGxDataset.Dataset ' Checking the diagram class existence in the selected schematic dataset Set pSchDiagramClassContainer = pSchematicDataset Set pSchDiagramClass = pSchDiagramClassContainer.SchematicDiagramClassByName(MyNewDiagramClassName) ' When the diagram class doesn't already exist, the CreateSchematicDiagramClass method is used to create it If pSchDiagramClass Is Nothing Then Set pSchDiagramClass = pSchematicDataset.CreateSchematicDiagramClass(MyNewDiagramClassName, Nothing, Nothing, Nothing, "") ' Then, a new instance of the SchematicStandardBuilder class is created Set pSchStandardBuilder = CreateObject("esriSchematic.SchematicStandardBuilder") ' The properties for this new builder are specified pSchStandardBuilder.AutoCreateElementClasses = True pSchStandardBuilder.InitializeLinksVertices = True pSchStandardBuilder.AddConnectedNodes = True Set pSchBuilder = pSchStandardBuilder Set pSchBuilderProps = pSchBuilder Set pSchBuilderDesc = pSchBuilder Set pPropertySet = pSchBuilderProps.PropertySet Set pUID = pSchBuilderDesc.ClassID ' The newly created builder is associated with the new diagram class pSchDiagramClass.AlterBuilder pUID, pPropertySet End If ' Getting the context that will be used to build the diagram Set pSchStandardBuilderCtxt = CreateObject("esriSchematic.SchematicStandardBuilderContext") Set pSchStandardBuilderCtxt.InitialObjects = pSchematicEnumObject ' Generating the diagram DiagramName = "Diagram_" & pSchDiagramClass.SchematicDiagrams.Count + 1 Set pSchematicDiagram = pSchDiagramClass.SchematicBuilder.GenerateDiagram(DiagramName, , , pSchStandardBuilderCtxt) ' Displaying the diagram Set pSchematicLayer = New SchematicLayer Set pSchematicLayer.SchematicDiagram = pSchematicDiagram Set pLayer = pSchematicLayer pLayer.Name = DiagramName pMap.AddLayer pLayer Err.Clear End Sub Private Sub ICommand_OnCreate(ByVal hook As Object) Set m_pApp = hook End Sub Private Property Get ICommand_Tooltip() As String 'String that appears in the screen tip. ICommand_Tooltip = "Generate Diagram From Selection" End Property
... View more
01-07-2011
08:38 PM
|
0
|
0
|
736
|
POST
|
heeeeeeeeee, we have solved the problem and we r very glad to tell that we can now generate schematic diagram on web without using GP tools... actually issue was with License file. Thanx Rick for your wonderfull support from me and Rajesh. if want then please contact on : sandeep.midgule@gmail.com
... View more
08-06-2010
01:13 AM
|
0
|
0
|
591
|
POST
|
Dear Rick, I want to generate schematic diagram through code without using GP. please help.
... View more
07-09-2010
05:00 AM
|
0
|
0
|
591
|
POST
|
Hii All, I just want to know how to generate schematic Diagram on ArcGis Server. i m doing electric tracing and also using ArcFM server.. Please Help Me, Thanx In Advance Sandeep K Midgule,
... View more
06-09-2010
09:46 PM
|
0
|
19
|
1281
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|