Macro équations du second degré avec autocad 2004

Soyez le premier à donner votre avis sur cette source.

Vue 6 085 fois - Téléchargée 337 fois

Description

salut bon j'ai essayé de résoudre des équations du second degré avec autocad 2004 en support graphique...bon ca marche a vous de voir...avant de résoudre une équation faites un axes en 0,0,0 avec un espacement de grille de 0.5 (pour les autocadiens!) @+

Source / Exemple :


Private Sub CommandButton1_Click()
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim DELTA As Integer
Dim RESUL1 As Single
Dim RESUL2 As Single
Dim RESUL3 As Single

A = TextBox1.Text
B = TextBox2.Text
C = TextBox3.Text

DELTA = (B ^ 2) - 4 * (A * C)

If DELTA > 0 Then
RESUL1 = ((-B) - Sqr(DELTA)) / (2 * A)
RESUL2 = ((-B) + Sqr(DELTA)) / (2 * A)

Label1.Caption = "les deux solutions sont "
Label2.Caption = RESUL1
Label3.Caption = RESUL2
End If

If DELTA = 0 Then
RESUL3 = (-B) / (2 * A)
Label1.Caption = "la solution est"
Label2.Caption = RESUL3
Label3.Visible = False
End If

If DELTA < 0 Then
Label1.Caption = " pas de solution"
End If

End Sub

Private Sub CommandButton2_Click()
Dim x As Integer
Dim y As Single
Dim ya As Single
Dim yb As Single
Dim yc As Single
Dim yd As Single
Dim ye As Single
Dim yf As Single
Dim yg As Single
Dim yh As Single
Dim yi As Single
Dim yj As Single

Dim yk As Single
Dim yl As Single
Dim ym As Single
Dim yn As Single
Dim yo As Single
Dim yp As Single
Dim yq As Single
Dim yr As Single
Dim ys As Single
Dim yt As Single

Dim yu As Single
Dim yv As Single
Dim yw As Single
Dim yx As Single
Dim yy As Single
Dim yz As Single
Dim yza As Single
Dim yzb As Single
Dim yzc As Single
Dim yzd As Single

Dim yze As Single
Dim yzf As Single
Dim yzg As Single
Dim yzh As Single
Dim yzi As Single
Dim yzj As Single
Dim yzk As Single
Dim yzl As Single
Dim yzm As Single
Dim yzn As Single

Dim yzo As Single
Dim yzp As Single
Dim yzq As Single
Dim yzr As Single
Dim yzs As Single
Dim yzt As Single
Dim yzu As Single
Dim yzv As Single
Dim yzw As Single
Dim yzx As Single

Dim plineObj As AcadPolyline
Dim points(0 To 152) As Double
Dim A As Integer
Dim B As Integer
Dim C As Integer

A = TextBox1.Text
B = TextBox2.Text
C = TextBox3.Text

y = (A * ((-3) ^ 2)) + (B * (-3)) + C
ya = (A * ((-2.9) ^ 2)) + (B * (-2.9)) + C
yb = (A * ((-2.8) ^ 2)) + (B * (-2.8)) + C
yc = (A * ((-2.7) ^ 2)) + (B * (-2.7)) + C
yd = (A * ((-2.6) ^ 2)) + (B * (-2.6)) + C
ye = (A * ((-2.5) ^ 2)) + (B * (-2.5)) + C
yf = (A * ((-2.4) ^ 2)) + (B * (-2.4)) + C
yg = (A * ((-2.3) ^ 2)) + (B * (-2.3)) + C
yh = (A * ((-2.2) ^ 2)) + (B * (-2.2)) + C
yi = (A * ((-2.1) ^ 2)) + (B * (-2.1)) + C
yj = (A * ((-2) ^ 2)) + (B * (-2)) + C

yk = (A * ((-1.9) ^ 2)) + (B * (-1.9)) + C
yl = (A * ((-1.8) ^ 2)) + (B * (-1.8)) + C
ym = (A * ((-1.7) ^ 2)) + (B * (-1.7)) + C
yn = (A * ((-1.6) ^ 2)) + (B * (-1.6)) + C
yo = (A * ((-1.5) ^ 2)) + (B * (-1.5)) + C
yp = (A * ((-1.4) ^ 2)) + (B * (-1.4)) + C
yq = (A * ((-1.3) ^ 2)) + (B * (-1.3)) + C
yr = (A * ((-1.2) ^ 2)) + (B * (-1.2)) + C
ys = (A * ((-1.1) ^ 2)) + (B * (-1.1)) + C
yt = (A * ((-1) ^ 2)) + (B * (-1)) + C

yu = (A * ((-0.9) ^ 2)) + (B * (-0.9)) + C
yv = (A * ((-0.8) ^ 2)) + (B * (-0.8)) + C
yw = (A * ((-0.7) ^ 2)) + (B * (-0.7)) + C
yx = (A * ((-0.6) ^ 2)) + (B * (-0.6)) + C
yy = (A * ((-0.5) ^ 2)) + (B * (-0.5)) + C
yz = (A * ((-0.4) ^ 2)) + (B * (-0.4)) + C
yza = (A * ((-0.3) ^ 2)) + (B * (-0.3)) + C
yzb = (A * ((-0.2) ^ 2)) + (B * (-0.2)) + C
yzc = (A * ((-0.1) ^ 2)) + (B * (-0.1)) + C

yzd = (A * ((0) ^ 2)) + (B * (0)) + C

yze = (A * ((0.1) ^ 2)) + (B * (0.1)) + C
yzf = (A * ((0.2) ^ 2)) + (B * (0.2)) + C
yzg = (A * ((0.3) ^ 2)) + (B * (0.3)) + C
yzh = (A * ((0.4) ^ 2)) + (B * (0.4)) + C
yzi = (A * ((0.5) ^ 2)) + (B * (0.5)) + C
yzj = (A * ((0.6) ^ 2)) + (B * (0.6)) + C
yzk = (A * ((0.7) ^ 2)) + (B * (0.7)) + C
yzl = (A * ((0.8) ^ 2)) + (B * (0.8)) + C
yzm = (A * ((0.9) ^ 2)) + (B * (0.9)) + C
yzn = (A * ((1) ^ 2)) + (B * (1)) + C

yzo = (A * ((1.1) ^ 2)) + (B * (1.1)) + C
yzp = (A * ((1.2) ^ 2)) + (B * (1.2)) + C
yzq = (A * ((1.3) ^ 2)) + (B * (1.3)) + C
yzr = (A * ((1.4) ^ 2)) + (B * (1.4)) + C
yzs = (A * ((1.5) ^ 2)) + (B * (1.5)) + C
yzt = (A * ((1.6) ^ 2)) + (B * (1.6)) + C
yzu = (A * ((1.7) ^ 2)) + (B * (1.7)) + C
yzv = (A * ((1.8) ^ 2)) + (B * (1.8)) + C
yzw = (A * ((1.9) ^ 2)) + (B * (1.9)) + C
yzx = (A * ((2) ^ 2)) + (B * (2)) + C

points(0) = -3: points(1) = y: points(2) = 0
points(3) = -2.9: points(4) = ya: points(5) = 0
points(6) = -2.8: points(7) = yb: points(8) = 0
points(9) = -2.7: points(10) = yc: points(11) = 0
points(12) = -2.6: points(13) = yd: points(14) = 0
points(15) = -2.5: points(16) = ye: points(17) = 0
points(18) = -2.4: points(19) = yf: points(20) = 0
points(21) = -2.3: points(22) = yg: points(23) = 0
points(24) = -2.2: points(25) = yh: points(26) = 0
points(27) = -2.1: points(28) = yi: points(29) = 0
points(30) = -2: points(31) = yj: points(32) = 0

points(33) = -1.9: points(34) = yk: points(35) = 0
points(36) = -1.8: points(37) = yl: points(38) = 0
points(39) = -1.7: points(40) = ym: points(41) = 0
points(42) = -1.6: points(43) = yn: points(44) = 0
points(45) = -1.5: points(46) = yo: points(47) = 0
points(48) = -1.4: points(49) = yp: points(50) = 0
points(51) = -1.3: points(52) = yq: points(53) = 0
points(54) = -1.2: points(55) = yr: points(56) = 0
points(57) = -1.1: points(58) = ys: points(59) = 0
points(60) = -1: points(61) = yt: points(62) = 0

points(63) = -0.9: points(64) = yu: points(65) = 0
points(66) = -0.8: points(67) = yv: points(68) = 0
points(69) = -0.7: points(70) = yw: points(71) = 0
points(72) = -0.6: points(73) = yx: points(74) = 0
points(75) = -0.5: points(76) = yy: points(77) = 0
points(78) = -0.4: points(79) = yz: points(80) = 0
points(81) = -0.3: points(82) = yza: points(83) = 0
points(84) = -0.2: points(85) = yzb: points(86) = 0
points(87) = -0.1: points(88) = yzc: points(89) = 0

points(90) = 0: points(91) = yzd: points(92) = 0

points(93) = 0.1: points(94) = yze: points(95) = 0
points(96) = 0.2: points(97) = yzf: points(98) = 0
points(99) = 0.3: points(100) = yzg: points(101) = 0
points(102) = 0.4: points(103) = yzh: points(104) = 0
points(105) = 0.5: points(106) = yzi: points(107) = 0
points(108) = 0.6: points(109) = yzj: points(110) = 0
points(111) = 0.7: points(112) = yzk: points(113) = 0
points(114) = 0.8: points(115) = yzl: points(116) = 0
points(117) = 0.9: points(118) = yzm: points(119) = 0
points(120) = 1: points(121) = yzn: points(122) = 0

points(123) = 1.1: points(124) = yzo: points(125) = 0
points(126) = 1.2: points(127) = yzp: points(128) = 0
points(129) = 1.3: points(130) = yzq: points(131) = 0
points(132) = 1.4: points(133) = yzr: points(134) = 0
points(135) = 1.5: points(136) = yzs: points(137) = 0
points(138) = 1.6: points(139) = yzt: points(140) = 0
points(141) = 1.7: points(142) = yzu: points(143) = 0
points(144) = 1.8: points(145) = yzv: points(146) = 0
points(147) = 1.9: points(148) = yzw: points(149) = 0
points(150) = 2: points(151) = yzx: points(152) = 0

  
Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
ZoomAll

      

End Sub

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.