Re: Autocad electrical | Sujet: Re: Autocad electrical par totonold sur 6/10/2009 11:12:06
Bonjour, Voici un bout de code VB pour créer une ligne dans le dessin actif.
Sub Ch2_AddLineVB()
On Error Resume Next
' Connect to the AutoCAD application
Dim acadApp As AcadApplication
Set acadApp = GetObject _
(, "AutoCAD.Application.18")
If Err Then
Err.Clear
Set acadApp = CreateObject _
("AutoCAD.Application.18")
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
' Connect to the AutoCAD drawing
Dim acadDoc As AcadDocument
Set acadDoc = acadApp.ActiveDocument
' Establish the endpoints of the line
Dim lineObj As AcadLine
Dim startPoint(0 To 2) As Double
Dim endPoint(0 To 2) As Double
startPoint(0) = 1
startPoint(1) = 1
startPoint(2) = 0
endPoint(0) = 5
endPoint(1) = 5
endPoint(2) = 0
' Create a Line object in model space
Set lineObj = acadDoc.ModelSpace.AddLine _
(startPoint, endPoint)
ZoomAll
acadApp.visible = True
End Sub
Si vous pouviez me donner l'impulsion de démarrage Je peux vous faire parvenir le .tlb si vous cela peut vous aider. Cordialement,
|
|
Connexion
Menu
Chercher WDForge
Chercher Web
Partenaires
|