#1 Thu 31 May 2012 19:24
- jawa
- Juste Inscrit !
- Date d'inscription: 9 Apr 2012
- Messages: 2
vba sous arcgis
bonjour à tous
Le code suivant me permet d'exporter la vue active de arcmap sous format jpg dans le chemin spécifié dans le code , j'aimrai que le programme supprime et remplace l'image si elle existe déjà.
Code:
Dim pMxDoc As IMxDocument
Dim pActiveView As IActiveView
Dim pExport As IExport
Dim pPixelBoundsEnv As IEnvelope
Dim exportRECT As tagRECT
Dim iOutputResolution As Integer
Dim iScreenResolution As Integer
Dim hDC As Long
Set pMxDoc = ThisDocument
Set pActiveView = pMxDoc.ActiveView
Set pExport = New ExportJPEG
pExport.ExportFileName = ("D:\ortho3.") & Right(pExport.Filter, 3)
iScreenResolution = 96 'default screen resolution is usually 96dpi
iOutputResolution = 96
pExport.Resolution = iOutputResolution
With exportRECT
.Left = 0
.Top = 0
.Right = pActiveView.ExportFrame.Right * (iOutputResolution / iScreenResolution)
.bottom = pActiveView.ExportFrame.bottom * (iOutputResolution / iScreenResolution)
End With
Set pPixelBoundsEnv = New Envelope
pPixelBoundsEnv.PutCoords exportRECT.Left, exportRECT.Top, exportRECT.Right, exportRECT.bottom
pExport.PixelBounds = pPixelBoundsEnv
hDC = pExport.StartExporting
pActiveView.Output hDC, pExport.Resolution, exportRECT, Nothing, Nothing
pExport.FinishExporting
pExport.Cleanupsi vous avez une idée comment ça marche aidez moi ,je serai reconnaissante.
merci
Hors ligne
#2 Fri 01 June 2012 07:42
Re: vba sous arcgis
Bonjour,
Vous pouvez utiliser le code suivant:
Code:
Dim oSFS As Object
Dim MonFichier As String
MonFichier = "D:\ortho3."
Set oSFS = CreateObject("Scripting.FileSystemObject")
If oSFS.FileExists(MonFichier) = True Then
oSFS.DeleteFile (MonFichier), True
End ifSalutations
Raphael
Hors ligne
#3 Sat 31 May 2014 11:21
- Teyib27609
- Juste Inscrit !
- Date d'inscription: 25 Dec 2013
- Messages: 3
Re: vba sous arcgis
jawa, l'opération est faite par votre code sans utilisé celui de Raphael
mais si je veux garder le fichier existant, pouvez vous m'aider slvp je travail sur mon PFE et merci
Hors ligne


