Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Visual Basic
- Forma1 -> Kruznica,sa Korakom 2 i BrojKruznica je 3
- Manage -> Visual Basic Editor -> Insert -> UserForm -> TextBox... -> 2xKlik -> Procedura
- Private Sub CommandButton1_Click()
- Dim Centar(0 To 2) As Double
- Dim Obj As Variant
- Obj = Split(Me.TextBox1.Text, ",")
- Centar(0) = CDbl(Obj(0))
- Centar(1) = CDbl(Obj(1))
- Centar(2) = CDbl(Obj(2))
- Dim Radijus As Double
- Radijus = CDbl(Me.TextBox2.Text)
- Dim Korak As Double
- Korak = CDbl(Me.TextBox3.Text)
- Dim Broj As Double
- Broj = CInt(Me.TextBox4.Text)
- Dim circ As AcadCircle
- Dim i As Integer
- For i = 0 To (Broj - 1)
- Set circ = ThisDrawing.ModelSpace.AddCircle(Centar, Radijus + i * Korak)
- circ.Update
- Next i
- Unload Me
- End Sub
- Krug i MaliKrug
- Private Sub CommandButton1_Click()
- Dim Centar(0 To 2) As Double
- Dim Radijus As Double
- Dim obj As Variant
- obj = Split(Me.TextBox1.Text, ",")
- Centar(0) = CDbl(obj(0))
- Centar(1) = CDbl(obj(1))
- Centar(2) = CDbl(obj(2))
- Radijus = CDbl(Me.TextBox2)
- Dim circ As AcadCircle
- Set circ = ThisDrawing.ModelSpace.AddCircle(Centar, Radijus)
- circ.Update
- Dim r As Double
- r = CDbl(Me.TextBox3)
- Dim Broj As Integer
- Broj = CInt(Me.TextBox4)
- Dim udaljenost As Double
- udaljenost = Radijus + r
- Dim MaliCentar(0 To 2) As Double
- MaliCentar(0) = Centar(0) + udaljenost
- MaliCentar(1) = Centar(1)
- MaliCentar(2) = Centar(2)
- Dim malikrug As AcadCircle
- Set malikrug = ThisDrawing.ModelSpace.AddCircle(MaliCentar, r)
- malikrug.Update
- Unload Me
- End Sub
- Krug + Okruzen Krugovima
- Private Sub CommandButton1_Click()
- Dim Centar(0 To 2) As Double
- Dim Radijus As Double
- Dim obj As Variant
- obj = Split(Me.TextBox1.Text, ",")
- Centar(0) = CDbl(obj(0))
- Centar(1) = CDbl(obj(1))
- Centar(2) = CDbl(obj(2))
- Radijus = CDbl(Me.TextBox2)
- Dim circ As AcadCircle
- Set circ = ThisDrawing.ModelSpace.AddCircle(Centar, Radijus)
- circ.Update
- Dim r As Double
- r = CDbl(Me.TextBox3)
- Dim Broj As Integer
- Broj = CInt(Me.TextBox4)
- Dim udaljenost As Double
- udaljenost = Radijus + r
- Dim MaliCentar(0 To 2) As Double
- MaliCentar(0) = Centar(0) + udaljenost
- MaliCentar(1) = Centar(1)
- MaliCentar(2) = Centar(2)
- Dim ugao As Double
- ugao = 360#
- Dim PI As Double
- PI = 4# * Math.Atn(1#)
- ugao = (2# * PI) / Broj
- Dim malikrug As AcadCircle
- Set malikrug = ThisDrawing.ModelSpace.AddCircle(MaliCentar, r)
- malikrug.Update
- Call malikrug.ArrayPolar(Broj, ugao, Centar)
- Unload Me
- End Sub
- Visual Lisp
- ;| (command "CIRCLE"
- (list (+(+ (nth 0 centar) poluprecnik) r)
- (nth 1 centar)
- (nth 2 centar)
- )
- r
- ""
- )
- (command "CIRCLE"
- (list (nth 0 centar)
- (+(+ (nth 1 centar) poluprecnik) r)
- (nth 2 centar)
- )
- r
- "")
- (command "CIRCLE"
- (list (nth 0 centar)
- -(+(+ (nth 1 centar) poluprecnik) r)
- (nth 2 centar)
- )
- r
- "")|;
- (defun fun (/ centar poluprecnik broj r brojac ugao udaljenost)
- ; unos centra poluprecnika broja i radijusa
- (setq centar (getpoint "\nIzaberite centar"))
- (setq poluprecnik (getreal "\nIzaberite poluprecnik:"))
- (setq broj (getint "\nIzaberite broj:"))
- (setq r (getreal "Izaberite radijus:"))
- (command "CIRCLE" centar poluprecnik "")
- (setq brojac 0)
- (setq ugao (/(* (pi)2)broj))
- (setq udaljenost (+(+ poluprecnik)r) )
- (repeat broj
- (command "CIRCLE" (polar centar (* brojac ugao) udaljenost) r "")
- (setq brojac (+ (brojac 1)) )
- )
- )
- ;|(defun fun (/ centar poluprecnik broj r brojac ugao udaljenost)
- ; unos centra poluprecnika broja i radijusa
- (setq centar (getpoint "\nIzaberite centar"))
- (setq poluprecnik (getreal "\nIzaberite poluprecnik:"))
- (setq broj (getint "\nIzaberite broj:"))
- (setq r (getreal "Izaberite radijus:"))
- (command "CIRCLE" centar poluprecnik)
- ;dodamo po x
- (command "CIRCLE"
- (list (+(+ (nth 0 centar) poluprecnik) r)
- (nth 1 centar)
- (nth 2 centar)
- )
- r
- ""
- )
- ;dodamo po y
- (command "CIRCLE"
- (list (nth 0 centar)
- (+(+ (nth 1 centar) poluprecnik) r)
- (nth 2 centar)
- )
- r
- "")
- ;oduzmemo po y
- (command "CIRCLE"
- (list (nth 0 centar)
- ( -(+(+ (nth 1 centar) poluprecnik) r))
- (nth 2 centar)
- )
- r
- "")
- ;oduzmemo po x
- (command "CIRCLE"
- (list (-(+(+ (nth 0 centar) poluprecnik) r))
- (nth 1 centar)
- (nth 2 centar)
- )
- r
- ""
- )
- ) |;
- RADI
- (defun fun ( / centar poluprecnik broj r i ugao udaljenost )
- (setq centar (getpoint "\nIzaberite centar"))
- (setq poluprecnik (getreal "\nIzaberite poluprecnik:"))
- (setq broj (getint "\nIzaberite broj:"))
- (setq r (getreal "Izaberite radijus:"))
- (command "CIRCLE" centar poluprecnik "\n")
- (setq i 0)
- (setq ugao (/ (* 2 pi) broj))
- (setq udaljenost (+ poluprecnik r))
- (repeat broj
- (command "CIRCLE" (polar centar (* i ugao) udaljenost) r "\n")
- (setq i (+ i 1))
- )
- )
- Pravogaonik RectChamfer
- Public Sub RectChamfer(x As Double, y As Double, a As Double, b As Double, c1 As Double, c2 As Double)
- Dim p(0 To 15) As Double
- p(0) = x + c1: p(1) = y: p(2) = x: p(3) = y + c2: p(4) = x: p(5) = y + b - c2: p(6) = x + c1: p(7) = y + b: p(8) = x + a - c1: p(9) = y + b: p(10) = x + a: p(11) = y + b - c2: p(12) = x + a: p(13) = y + c1: p(14) = x + a - c2: p(15) = y
- Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(p)
- pline.Closed = True
- pline.Update
- End Sub
- Sub Main()
- Call RectChamfer(0, 0, 20, 10, 3, 3)
- End Sub
- RecFillet Mirela.De
- Public Sub RectFillet(x As Double, y As Double, a As Double, b As Double, f As Double)
- Dim p(0 To 15) As Double
- p(0) = x + f: p(1) = y: p(2) = x: p(3) = y + f: p(4) = x: p(5) = y + b - f: p(6) = x + f: p(7) = y + b: p(8) = x + a - f: p(9) = y + b: p(10) = x + a: p(11) = y + b - f: p(12) = x + a: p(13) = y + f: p(14) = x + a - f: p(15) = y
- Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(p)
- pline.Closed = True
- Dim pi As Double
- pi = 4# * Math.Atn(1#)
- pline.SetBulge 0, -Math.Tan(pi / 8)
- pline.SetBulge 2, -Math.Tan(pi / 8)
- pline.SetBulge 4, -Math.Tan(pi / 8)
- pline.SetBulge 6, -Math.Tan(pi / 8)
- pline.Update
- End Sub
- Sub Main()
- Call RectFillet(0, 0, 20, 10, 3)
- End Sub
- Zadatak Tastatura
- Public Sub RectFillet(x As Double, y As Double, a As Double, b As Double, f As Double)
- Dim p(0 To 15) As Double
- p(0) = x + f: p(1) = y: p(2) = x: p(3) = y + f: p(4) = x: p(5) = y + b - f: p(6) = x + f: p(7) = y + b: p(8) = x + a - f: p(9) = y + b: p(10) = x + a: p(11) = y + b - f: p(12) = x + a: p(13) = y + f: p(14) = x + a - f: p(15) = y
- Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(p)
- pline.Closed = True
- Dim pi As Double
- pi = 4# * Math.Atn(1#)
- pline.SetBulge 0, -Math.Tan(pi / 8)
- pline.SetBulge 2, -Math.Tan(pi / 8)
- pline.SetBulge 4, -Math.Tan(pi / 8)
- pline.SetBulge 6, -Math.Tan(pi / 8)
- pline.Update
- End Sub
- Public Sub Keyboard(columns As Integer, rows As Integer, width As Double, height As Double, hspace As Double, vspace As Double)
- Dim i As Integer, j As Integer
- For i = 0 To rows - 1
- For j = 0 To columns - 1
- Dim x As Double, y As Double, f As Double
- If width < height Then f = width / 10 Else f = height / 10
- x = j * (width + hspace)
- y = i * (height + vspace)
- Call RectFillet(x, y, width, height, f)
- Next
- Next
- End Sub
- Sub Main()
- Call Keyboard(12, 4, 10, 12, 2, 4)
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement