Jump to content
Sign in to follow this  
MrCreatoR

Drawn arrows (up and down)

Recommended Posts

Hi,

I would like to drawn arrows, but i need to able change the direction of the arrows dinamicly..

How can i do this? i tried with GuiCtrlCreateGraphic() and GuiCtrlSetGraphic(), but i can not drawn in the same time two diagonal lines.

I do not want to do this with images or symbols methods, only drawn them.

P.S

It will be great if those arrows will look like this:

Posted Image

Thanks.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Might take a look at the functions _GDIPlus_Arrowxxxxxxx

Thanks, but i can't find it anywhere, i looked here on the forum, and in the A3LLibrary, but can't find it <_< - maybe this is in beta functions? i am not using beta.

These characters have the following codes

As i wrote:

I do not want to do this with images or symbols methods, only drawn them

The arrows on the image was maded by chars :)

The chars method is problematic, it not displayed correctly on some systems.

But thanks anyway.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Script ALS is in Files/Misc of this

Can you post here a direct likn to download please? i can't find it there.

Thanks.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

i can't find it there.

I should to sign in this forum.

But, why not? ALS.au3 is here. Take it:

;================================

; ALS, © Valery Ivanov, 24 June, 2007

; ALS is Auto Lindenmayer System viewer example

; ALS examples were taken from book:

; "The Algorithmic Beauty of Plants"

; by P.Prusinkiewich, A.Lindenmayer

; Home page:

; http://algorithmicbotany.org/

; History

; v. 0.4 - 29 June 2007

; fix - controls can be resized

; updated - use only gdi32.dll

; v. 0.6 - 4 July 2007

; added - new examples

; v. 0.7 - 22 July 2007

; added - examples "Bush" and "Fern List"

; v. 0.8 - 22 July 2007

; added - examples for Penrose tiling

; added - two pens and turtle's command to select ('2' - first pen; '4' - second one)

;

#include <GUIConstants.au3>

;======================

; Lindenmayer system (LS) definition

; The alphabet of the LS

Global $V

; LS Axiom

Global $Omega

; LS Production Rules

Global $ProductionCount

; LS Array of Predecessors

Global $Predecessor

; LS Array of Successors

Global $Successor

; LS Predecessors - list of left parts of rules

Global $Predecessors

; Successors - list of right parts of rules

Global $Successors

;======================

; A turtle state

Global $x = 100, $y = 250, $alpha = 0

; turtle step size

Global $d

; turtle angle increment

Global $delta

; turtle width increment

Global $Width_Increment = 1

; turtle length increment

Global $Length_Increment = 2

; turtle Delta increment

Global $Delta_Increment = 2

;======================

; Gui variables

Global $WinTitle = 'ALS v 0.8, © Valery Ivanov, 24 June, 2007'

Global $hWnd

Global $WinRect, $WinRectNew

Global $WinW = 700, $WinH = 500

Global $WinX = (@DesktopWidth - $WinW)/2

Global $WinY = (@DesktopHeight - $WinH)/2

;======================

; Edit variables

Global $Desc, $hDesc

Global $DescX = 10, $DescY = 100, $DescW = 190, $DescH = 350

;======================

; Bar size

Global $BarSize = 7

;======================

; VBar variables

Global Const $BarColor = 0xFF0000

Global $VBar

Global $VBarX = $DescX + $DescW, $VBarY = $DescY, $VBarW = $BarSize, $VBarH = $DescH

;======================

; Pic variables

Global $PicX = $VBarX + $VBarW, $PicY = $DescY, $PicW = $WinW - $PicX - 10, $PicH = $DescH

Global $Pic, $hPic

Global $hDC, $Brush, $Rgn

Global $Pen, $Pen2, $Pen3, $Pen4, $PenWidth = 2

Global $PenColor = 0xA49500, $PenColor2 = 0x8080FF, $PenColor3 = 0x80FF80, $PenColor4 = 0xFF8080

Global $BrushColor = 0xD5EFFF

Global $AspectRatio

Global $Decrease, $Increase

;======================

; Current state of View

;----------------------

; Turtle variables

Global $x = 0, $y = 0, $angle = 0, $d = 1

Global $Stack_x_0, $Stack_y_0, $Stack_a_0, $Stack_s_0

;----------------------

; Picture variables

Global $Pic, $hPic

;----------------------

; LS variables

Global $LS_Name = 'Hilbert_curve'

Global $IniFile

Global $stringLS, $Generation_Level

Global $Sp = 0

Global $DrawFlag = False

Global $DrawFlag = False

Global $mX = 1, $mY = 1, $dX = 0, $dY = 0

Global $xMin = 0, $xMax = 0

Global $yMin = 0, $yMax = 0

;======================

; vi button

Global Const $viColor = 0xFF0000

Global $vi, $viSize = 12

Global $viX = $WinW-$viSize, $viY = $WinH-$viSize, $viW = $viSize, $viH = $viSize

;======================

; Libs variables

Global $user = DllOpen("user32.dll")

Global $gdi = DllOpen("gdi32.dll")

$hWnd = GUICreate($WinTitle, $WinW, $WinH, $WinX, $WinY, $WS_OVERLAPPEDWINDOW)

$WinRect = WinGetClientSize($hWnd)

$LSource = GUICtrlCreateLabel ("LS db file:", 10, 15, 50, 20)

GUICtrlSetResizing ($LSource, $GUI_DOCKALL)

$ISource = GUICtrlCreateInput (@ScriptDir & "\als.sla", 70, 10, 200, 20)

GUICtrlSetResizing ($ISource, $GUI_DOCKALL)

$BSource = GUICtrlCreateButton("Browse", 290, 10, 70, 20)

GUICtrlSetResizing ($BSource, $GUI_DOCKALL)

$AspectRatio = GUICtrlCreateCheckbox('Preserve aspect ratio', 550, 10, 150, 20)

GUICtrlSetState ($AspectRatio, $GUI_CHECKED)

$LType = GUICtrlCreateLabel ("LS type:", 10, 45, 50, 20)

GUICtrlSetResizing ($LType, $GUI_DOCKALL)

$CType = GUICtrlCreateCombo('Hilbert_curve', 70, 40, 100, 25)

GUICtrlSetResizing ($CType, $GUI_DOCKALL)

$Desc = GUICtrlCreateEdit('', $DescX, $DescY, $DescW, $DescH)

$Decrease = GUICtrlCreateButton ("<", 10, 75, 20, 20)

GUICtrlSetTip($Decrease,"Decrease level of generation")

GUICtrlSetResizing ($Decrease, $GUI_DOCKALL)

$Increase = GUICtrlCreateButton (">", 35, 75, 20, 20)

GUICtrlSetTip($Increase,"Increase level of generation")

GUICtrlSetResizing ($Increase, $GUI_DOCKALL)

; Create VBar

$VBar = GuiCtrlCreateButton("", $VBarX, $VBarY, $VBarW, $VBarH)

GUICtrlSetResizing ($VBar, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH)

GUICtrlSetTip($VBar, "Click & Drag left or right to resize Editor and Picture")

GUICtrlSetCursor ($VBar, 13)

GUICtrlSetColor ($VBar, $BarColor)

$Repaint = GUICtrlCreateButton ("Repaint", ($WinW/3)-50, 470, 100, 20)

GUICtrlSetTip($Repaint,"Repaint LS selected")

$Start = GUICtrlCreateButton ("Start", 2*($WinW/3)-50, 470, 100, 20)

GUICtrlSetTip($Start,"For future!")

;ControlName = 'Static3'

$Pic = GUICtrlCreatePic('', $PicX, $PicY, $PicW, $PicH, $SS_SUNKEN)

$hPic = ControlGetHandle($WinTitle, '', 'Static3')

$hDC = DllCall($user, "int", "GetDC", "hwnd", $hPic)

$hDC = $hDC[0]

$Pen = DllCall($gdi, "int", "CreatePen", "int", 0, "int", $PenWidth, "int", $PenColor)

$Pen = $Pen[0]

$Pen2 = DllCall($gdi, "int", "CreatePen", "int", 0, "int", $PenWidth, "int", $PenColor2)

$Pen2 = $Pen2[0]

$Pen3 = DllCall($gdi, "int", "CreatePen", "int", 0, "int", $PenWidth, "int", $PenColor3)

$Pen3 = $Pen3[0]

$Pen4 = DllCall($gdi, "int", "CreatePen", "int", 0, "int", $PenWidth, "int", $PenColor4)

$Pen4 = $Pen4[0]

$Brush = DllCall($gdi, "hwnd", "CreateSolidBrush", "int", $BrushColor)

$Brush = $Brush[0]

DllCall($gdi, "int", "SelectObject", "int", $hDC, "int", $Pen)

DllCall($gdi, "int", "SelectObject", "int", $hDC, "int", $Brush)

$Rgn = CreateRectRgn(0, 0, $PicW, $PicH)

SetPen($Pen)

GUISetState()

$IniFile = @ScriptDir & '\als.sla'

ResetLSNames($IniFile)

While 1

$Msg = GUIGetMsg(1)

Select

Case $Msg[0] = $GUI_EVENT_CLOSE

Exit

Case $Msg[0] = $GUI_EVENT_MOUSEMOVE

MouseMoveHandler($Msg)

Case $Msg[0] = $BSource

$IniFile = FileOpenDialog('Source File', @ScriptDir, 'ALS Data File (*.sla)', 1 )

GUICtrlSetData($ISource,$IniFile)

ResetLSNames($IniFile)

Case $Msg[0] = $CType

$LS_Name = GUICtrlRead($CType)

defineLS($LS_Name)

$Text = 'Omega=' & $Omega & @CrLf & 'Predecessors=' & $Predecessors & @CrLf & 'Successors=' & $Successors & @CrLf

$Text &= 'Alpha=' & $alpha & @CrLf & 'Delta=' & $delta & @CrLf & 'Generation_Level=' & $Generation_Level & @CrLf

GUICtrlSetData($Desc,$Text)

; draw this LS generation

; Evaluate rectangle to draw

evalLS()

; Draw it

Repaint()

Case $Msg[0] = $Start

Case $Msg[0] = $Repaint

Repaint()

Case $Msg[0] = $Decrease

if $Generation_Level > 1 then

$Generation_Level -= 1

$stringLS = getLS($Generation_Level)

$s = StringSplit($stringLS,'')

$Stack_s_0 = $s

; draw this LS generation

; Evaluate rectangle to draw

evalLS()

; Draw it

Repaint()

endif

Case $Msg[0] = $Increase

$Generation_Level += 1

$stringLS = getLS($Generation_Level)

$s = StringSplit($stringLS,'')

$Stack_s_0 = $s

; draw this LS generation

; Evaluate rectangle to draw

evalLS()

; Draw it

Repaint()

Case else

;handler of other events

Process($Msg[0])

EndSelect

WEnd

exit

;===============

func ResetLSNames($IniFile)

local $LSs, $L

$LSs = IniReadSectionNames($IniFile)

$L = ''

for $i = 1 to $LSs[0]

$L &= $LSs[$i]

if $i <> $LSs[0] then $L &= '|'

next

GUICtrlSetData ($CType, '')

GUICtrlSetData ($CType, $L)

endfunc

;===============

func Repaint()

ControlHide ( $hWnd, "", "Static3")

ControlShow ( $hWnd, "", "Static3")

DllCall($user, "int", "ReleaseDC", "hwnd", 0, "int", $hDC)

$hDC = DllCall($user, "int", "GetDC", "hwnd", $hPic)

$hDC = $hDC[0]

$Rgn = CreateRectRgn(0, 0, $PicW, $PicH)

FillRgn()

SetPen($Pen)

; Draw it

if IsArray($Stack_s_0) then drawLS()

endfunc

;===============

func defineLS($LS_Name)

local $s

; turtle

$x = 0

$y = 0

$alpha = 0

$d = 1

if $LS_Name = 'Hilbert_curve' then

$Omega = 'X'

$Predecessors = 'X,Y'

$Successors = '+YF-XFX-FY+,-XF+YFY+FX-'

; angle increment

$delta = 90

$Generation_Level = 5

else

$Omega = IniRead($IniFile,$LS_Name,'Omega','')

$Predecessors = IniRead($IniFile,$LS_Name,'Predecessors','')

$Successors = IniRead($IniFile,$LS_Name,'Successors','')

$alpha = IniRead($IniFile,$LS_Name,'alpha','')

$delta = IniRead($IniFile,$LS_Name,'delta','')

$Generation_Level = IniRead($IniFile,$LS_Name,'Generation_Level','')

endif

$Predecessor = StringSplit($Predecessors,',')

$Successor = StringSplit($Successors,',')

$ProductionCount = $Predecessor[0]

;Save initial turtle state

$Stack_a_0 = $alpha

;Save LS path

; get string view of this LS generation

$stringLS = getLS($Generation_Level)

$s = StringSplit($stringLS,'')

$Stack_s_0 = $s

endfunc

;===============

func getLS($Generation_Level)

local $l

; Get axiom as a first LS generation

$l = $Omega

for $i = 1 to $Generation_Level

;Get next LS generation from the last one

$l = getDerivation($l)

next

return $L

endfunc

;===============

; Get derivation based on rules specified

func getDerivation($String)

local $s, $n, $r, $l, $t

$s = StringSplit($String,'')

$n = $s[0]

$r = ''

for $i = 1 to $n

$l = $s[$i]

for $j = 1 to $ProductionCount

$t = $l

if $l = $Predecessor[$j] then

$t = $Successor[$j]

exitloop

endif

next

$r &= $t

next

return $r

endfunc

;============================================

func evalLS()

local $s

$x = 0

$y = 0

$mX = 1

$mY = 1

$xMin = 0

$xMax = 0

$yMin = 0

$yMax = 0

$DrawFlag = False

$alpha = $Stack_a_0

$s = $Stack_s_0

for $i = 1 to $s[0]

ATurtle($s[$i])

next

endfunc

;============================================

func drawLS()

local $s

$mX = ($PicW-3)/Abs($xMax-$xMin)

$mY = ($PicH-3)/Abs($yMax-$yMin)

if GUICtrlRead($AspectRatio) = $GUI_CHECKED then

if $PicW > $PicH then

$mX = ($PicH-3)/Abs($xMax-$xMin)

else

$mY = ($PicW-3)/Abs($yMax-$yMin)

endif

endif

$x = -$mX*$xMin

$y = -$mY*$yMin

$alpha = $Stack_a_0

$s = $Stack_s_0

$DrawFlag = True

for $i = 1 to $s[0]

ATurtle($s[$i])

next

endfunc

;============================================

; About Turtle interpretation of strings read in book above

;Turtle interpretation of DOL-systems

;F : Move forward a step of length d. The state of the turtle changes to (xn, yn, alpha)

;, where

;xn = x + d*cos(alpha)

;and

;yn = y + d*sin(alpha)

;A line segment between points (x, y) and (xn, yn) is drawn.

;

;f : Move forward a step of length d without drawing a line.

;

;+ : Turn left by angle delta. The next state of the turtle is (x, y, alpha+delta). The positive orientation of angles is counterclockwise.

;

;- : Turn right by angle delta. The next state of the turtle is (x, y, alpha-delta).

;

;[ : Push state of the turtle.

;

;] : Pop state of the turtle.

;

; From "Lecture Notes in Biomathematics" by Przemyslaw Prusinkiewcz and James Hanan

;

;| : Reverse direction for F.

;

;& : Swap the meaning of + and -.

;

;@ : Draw a dot with line width radius.

;

;> : Multiply the line length by the line length scale factor.

;

;< : Divide the line length by the line length scale factor.

;

;( : Decrement turning angle by turning angle increment.

;

:D : Increment turning angle by turning angle increment.

;

;{ : Open a polygon.

;

;1 : Select first pen

;

;2 : Select second pen

;

;3 : Select third pen

;

;4 : Select forth pen

;

;============================================

func ATurtle($c)

local $xn, $yn

select

case $c == 'F'

$xn = $x + $mX*$d*Cos(Rad($alpha))

$yn = $y + $mY*$d*Sin(Rad($alpha))

if $DrawFlag then

; Sleep(500)

MoveTo($x, $y)

LineTo($xn, $yn)

endif

$x = $xn

$y = $yn

if Not $DrawFlag then

CheckExtr($x,$y)

else

SetPen($Pen)

endif

case $c = '|'

$xn = $x + $mX*$d*Cos(Rad($alpha))/2

$yn = $y + $mY*$d*Sin(Rad($alpha))/2

if $DrawFlag then

; Sleep(500)

MoveTo($x, $y)

LineTo($xn, $yn)

endif

$x = $xn

$y = $yn

if Not $DrawFlag then

CheckExtr($x,$y)

else

SetPen($Pen)

endif

$alpha += 180

$xn = $x + $mX*$d*Cos(Rad($alpha))/2

$yn = $y + $mY*$d*Sin(Rad($alpha))/2

if $DrawFlag then

; Sleep(500)

MoveTo($x, $y)

LineTo($xn, $yn)

endif

$x = $xn

$y = $yn

if Not $DrawFlag then

CheckExtr($x,$y)

else

SetPen($Pen)

endif

$alpha -= 180

case $c == 'f'

$x += $mX*$d*Cos(Rad($alpha))

$y += $mY*$d*Sin(Rad($alpha))

if Not $DrawFlag then

CheckExtr($x,$y)

else

SetPen($Pen)

endif

case $c == '+'

$alpha += $delta

case $c == '-'

$alpha -= $delta

case $c == '['

$Sp += 1

Assign('Stack_x_' & $SP, $x, 2)

Assign('Stack_y_' & $SP, $y, 2)

Assign('Stack_a_' & $SP, $alpha, 2)

case $c == ']'

if $Sp then

$x = Eval('Stack_x_' & $SP)

$y = Eval('Stack_y_' & $SP)

$alpha = Eval('Stack_a_' & $SP)

$Sp -= 1

endif

case $c == '>'

$d *= $Length_Increment

case $c == '<'

$d /= $Length_Increment

case $c == '('

$delta /= $Delta_Increment

case $c == ')'

$delta *= $Delta_Increment

; set first pen (default)

case $c == '1'

SetPen($Pen)

; set second pen

case $c == '2'

SetPen($Pen2)

; set second pen

case $c == '3'

SetPen($Pen3)

; set second pen

case $c == '4'

SetPen($Pen4)

endselect

endfunc

;============================================

func CheckExtr($x,$y)

if $xMin > $x then $xMin = $x

if $xMax < $x then $xMax = $x

if $yMin > $y then $yMin = $y

if $yMax < $y then $yMax = $y

endfunc

;============================================

func Rad($f)

return 3.141592653589793238462643*$f/180

endfunc

;=====================

func IsControl($Name, $X, $Y)

local $L, $T, $W, $H, $P

$P = ControlGetPos($hWnd, "", $Name)

if ($X > $P[0]) and ($X < $P[0]+$P[2]) and ($Y > $P[1]) and ($Y < $P[1]+$P[3]) then return 1

return 0

endfunc

;======================================================

func MouseMoveHandler($Msg)

local $Name, $Y, $P, $CursorInfo

local $Changed = 0, $VBarSelected = 0

if IsControl("Button5", $Msg[3], $Msg[4]) then $VBarSelected = 1

; if IsControl("Button6", $Msg[3], $Msg[4]) then Resize()

if Not $VBarSelected then return

$CursorInfo = GUIGetCursorInfo ($hWnd)

While $CursorInfo[2] = 1

$Changed = 1

$CursorInfo = GUIGetCursorInfo ($hWnd)

$VBarX = $CursorInfo[0]

GUICtrlSetPos($VBar, $VBarX, $VBarY)

WEnd

if $Changed = 1 then

$DescW = $VBarX - $DescX

$PicX = $VBarX + $VBarW

$PicW = $WinW - $VBarX - $VBarW - 10

GUICtrlSetPos($Desc, $DescX, $DescY, $DescW, $DescH)

GUICtrlSetPos($hPic, $PicX, $PicY, $PicW, $PicH)

ControlMove ( $WinTitle, '', 'Static3', $PicX, $PicY, $PicW, $PicH)

Repaint()

GUICtrlSetPos($VBar, $VBarX, $VBarY, $VBarW, $VBarH)

endif

endfunc

;=====================

func Resize()

$CursorInfo = GUIGetCursorInfo ($hWnd)

While $CursorInfo[2] = 1

$CursorInfo = GUIGetCursorInfo ($hWnd)

$ViX = $CursorInfo[0]

$ViY = $CursorInfo[1]

GUICtrlSetPos($Vi, $ViX, $ViY)

$WinRect = WinGetClientSize($hWnd)

WinMove ( $hWnd, '', $WinRect[0], $WinRect[1], $ViX+$viSize, $ViY+$viSize)

WEnd

endfunc

;=====================

func Process($msg)

$WinRectNew = WinGetClientSize($hWnd)

if not @error and ($WinRectNew[0] <> $WinRect[0] or $WinRectNew[1] <> $WinRect[1]) then

$WinRect = $WinRectNew

$WinW = $WinRect[0]

$WinH = $WinRect[1]

$DescH = $WinH - 150

$VBarH = $DescH

$TopicLabelW = $WinW - $VBarX - $VBarW - 10

$PicW = $WinW - $VBarX - $VBarW - 10

$PicH = $DescH

GUICtrlSetPos($Desc, $DescX, $DescY, $DescW, $DescH)

ControlMove ($WinTitle, '', 'Static3', $PicX, $PicY, $PicW, $PicH)

$Rgn = CreateRectRgn(0, 0, $PicW, $PicH)

Repaint()

GUICtrlSetPos($VBar, $VBarX, $VBarY, $VBarW, $VBarH)

endif

endfunc

Func MoveTo($x, $y)

DllCall($gdi, "long", "MoveToEx", "hwnd", $hDC, "int", $x, "int", $y, "ptr", 0)

endfunc

Func LineTo($x, $y)

DllCall($gdi, "int", "LineTo", "hwnd", $hDC, "int", $x, "int", $y)

endfunc

func CreateRectRgn($l, $t, $w, $h)

$ret = DllCall($gdi, "long", "CreateRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h)

Return $ret[0]

endfunc

func FillRgn()

DllCall($gdi, "int", "FillRgn", "hwnd", $hDC, "long", $Rgn, "hwnd", $Brush)

endfunc

func SetPen($Pen)

DllCall($gdi, "hwnd", "SelectObject", "hwnd", $hDC, "hwnd", $Pen)

endfunc

It use asl.sla file:

[Hilbert_curve]

Omega=X

Predecessors=X,Y

Successors=+YF-XFX-FY+,-XF+YFY+FX-

alpha=0

delta=90

Generation_Level=5

[Quadratic_Koch_Island]

Omega=F-F-F-F

Predecessors=F

Successors=F-F+F+FF-F-F+F

alpha=0

delta=90

Generation_Level=3

[Peano curve]

Omega=F

Predecessors=F

Successors=F+F-F-F-F+F+F+F-F

alpha=0

delta=90

Generation_Level=3

[Peano1]

Omega=F-F-F-F

Predecessors=F

Successors=F-F+F+F+F-F-F-F+F

alpha=0

delta=90

Generation_Level=3

[square curve]

Omega=X

Predecessors=X

Successors=XF-F+F-XF+F+XF-F+F-X

alpha=0

delta=90

Generation_Level=4

;=========================

; Fig 1.8 (a, <_<

[Combination]

Omega=F+F+F+F

Predecessors=F,f

Successors=F+f-FF+F+FF+Ff+FF-f+FF-F-FF-Ff-FFF,ffffff

alpha=0

delta=90

Generation_Level=2

;=========================

; Fig 1.9 (a, b, c, d, e, f)

[Combination_A]

Omega=F-F-F-F

Predecessors=F

Successors=FF-F-F-F-F-F+F

alpha=0

delta=90

Generation_Level=4

[Combination_B]

Omega=F-F-F-F

Predecessors=F

Successors=FF-F-F-F-FF

alpha=0

delta=90

Generation_Level=4

[Combination_C]

Omega=F-F-F-F

Predecessors=F

Successors=FF-F+F-F-FF

alpha=0

delta=90

Generation_Level=3

[Combination_D]

Omega=F-F-F-F

Predecessors=F

Successors=FF-F--F-F

alpha=0

delta=90

Generation_Level=4

[Combination_E]

Omega=F-F-F-F

Predecessors=F

Successors=F-FF--F-F

alpha=0

delta=90

Generation_Level=5

[Combination_F]

Omega=F-F-F-F

Predecessors=F

Successors=F-F+F-F-F

alpha=0

delta=90

Generation_Level=4

;=========================

; Fig 1.10 (a, :)

[Dragon]

Omega=L

Predecessors=L,R

Successors=L+RF+,-FL-R

alpha=0

delta=90

Generation_Level=12

[sierpinski_gasket]

Omega=R

Predecessors=L,R

Successors=RF-LF-R,LF+RF+L

alpha=0

delta=60

Generation_Level=8

[sierpinski curve]

Omega=L--F--L--F

Predecessors=L,R

Successors=+R-F-R+,-L+F+L-

alpha=45

delta=45

Generation_Level=9

;=========================

; Fig 1.11(a,:P

[Hexagonal_Gosper_curve]

Omega=L

Predecessors=L,R

; edge-rewriting - 'Fl+Fr++Fr-Fl--FlFl-Fr+,-Fl+FrFr++Fr+Fl--Fl-Fr'

Successors=L+RF++RF-FL--FLFL-RF+,-FL+RFRF++RF+FL--FL-R

alpha=0

delta=60

Generation_Level=4

;=========================

[Quadratic_Gosper_curve]

Omega=-R

Predecessors=L,R

; edge-rewriting - 'FlFl-Fr-Fr+Fl+Fl-Fr-FrFl+Fr+FlFlFr-Fl+Fr+FlFl+Fr-FlFr-Fr-Fl+Fl+FrFr-,+FlFl-Fr-Fr+Fl+FlFr+Fl-FrFr-Fl-Fr+FlFrFr-Fl-FrFl+Fl+Fr-Fr-Fl+Fl+FrFr'

Successors=LFL-RF-RF+FL+FL-RF-RFFL+RF+FLFLRF-FL+RF+FLFL+RF-FLRF-RF-FL+FL+RFRF-,+FLFL-RF-RF+FL+FLRF+FL-RFRF-FL-RF+FLRFRF-FL-RFFL+FL+RF-RF-FL+FL+RFR

alpha=0

delta=90

Generation_Level=2

;=========================

; Fig 1.16(a,:)

[FASS_curve_A]

Omega=-L

Predecessors=L,R

Successors=LF+RFR+FL-F-LFLFL-FRFR+,-LFLF+RFRFR+F+RF-LFL-FR

alpha=0

delta=90

Generation_Level=3

[FASS_curve_B]

Omega=-L

Predecessors=L,R

Successors=LFLF+RFR+FLFL-FRF-LFL-FR+F+RF-LFL-FRFRFR+,-LFLFLF+RFR+FL-F-LF+RFR+FLF+RFRF-LFL-FRFR

alpha=0

delta=90

Generation_Level=3

;=========================

; Fig 1.23

[Tree]

Omega=F

Predecessors=F

Successors=F+[+F][-F[-F]F]F[+F][-F]

alpha=270

delta=45

Generation_Level=1

;=========================

; Fig 1.24

[Tree_A]

Omega=F

Predecessors=F

Successors=F[+F]F[-F]F

alpha=270

delta=22.5

Generation_Level=5

[Tree_C]

Omega=F

Predecessors=F

Successors=FF-[-F+F+F]+[+F-F-F]

alpha=270

delta=22.5

Generation_Level=4

[Tree_D]

Omega=X

Predecessors=X,F

Successors=F[+X]F[-X]+X,FF

alpha=270

delta=20

Generation_Level=7

[Tree_E]

Omega=X

Predecessors=X,F

Successors=F[+X][-X]FX,FF

alpha=270

delta=25.7

Generation_Level=7

[Tree_F]

Omega=X

Predecessors=X,F

Successors=F-[[X]+X]+F[+FX]-X,FF

alpha=270

delta=22.5

Generation_Level=5

[Pentigree]

Omega=F-F-F-F-F

Predecessors=F

Successors=F-F++F+F-F-F

alpha=0

delta=72

Generation_Level=4

[Penrose Snowflake]

Omega=F----F----F----F----F

Predecessors=F

Successors=F----F----F----------F++F----F

alpha=0

delta=18

Generation_Level=3

[bush]

Omega=F

Predecessors=F

Successors=|[+F]|[-F]+F

alpha=270

delta=20

Generation_Level=5

[bush2]

Omega=++++F

Predecessors=F

Successors=FF-[-F+F+F]+[+F-F-F]

alpha=180

delta=20

Generation_Level=3

;=========================

; Tiling

[Hex]

Omega=F

Predecessors=F,G

Successors=-F+F+G[+F+F]-,GG

alpha=0

delta=60

Generation_Level=1

[square]

Omega=X

Predecessors=X,Y

Successors=[Y]FF+[Y]FF+[Y]FF+[Y]FF+,XF+XF+XF+XF+

alpha=0

delta=90

Generation_Level=1

[Triangle]

Omega=X

Predecessors=X,Y

Successors=[Y]FF+[Y]F+[Y]F+,

alpha=0

delta=120

Generation_Level=1

;=========================

; Penrose Tiling

[Penrose1]

Omega=+WF--XF---YF--ZF

Predecessors=W,X,Y,Z,F

Successors=YF++ZF----XF[-YF----WF]++,+YF--ZF[---WF--XF]+,-WF++XF[+++YF++ZF]-,--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[Penrose2]

Omega=++ZF----XF-YF----WF

Predecessors=W,X,Y,Z,F

Successors=YF++ZF----XF[-YF----WF]++,+YF--ZF[---WF--XF]+,-WF++XF[+++YF++ZF]-,--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[Penrose3]

Omega=[X]++[X]++[X]++[X]++[X]

Predecessors=W,X,Y,Z,F

Successors=YF++ZF----XF[-YF----WF]++,+YF--ZF[---WF--XF]+,-WF++XF[+++YF++ZF]-,--YF++++WF[+ZF++++XF]--XF,

alpha=18

delta=36

Generation_Level=4

[Penrose4]

Omega=[Y]++[Y]++[Y]++[Y]++[Y]

Predecessors=W,X,Y,Z,F

Successors=YF++ZF----XF[-YF----WF]++,+YF--ZF[---WF--XF]+,-WF++XF[+++YF++ZF]-,--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[PenroseTest]

Omega=W

Predecessors=W,X,Y,Z,F

Successors=YF|++ZF----XF[-YF----WF]++,|+YF--ZF[---WF--XF]+,|-WF++XF[+++YF++ZF]-,|--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=1

[PenroseW]

Omega=W

Predecessors=W,X,Y,Z,F

Successors=YF|++ZF----XF[-YF----WF]++,|+YF--ZF[---WF--XF]+,|-WF++XF[+++YF++ZF]-,|--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[PenroseX]

Omega=X

Predecessors=W,X,Y,Z,F

Successors=YF|++ZF----XF[-YF----WF]++,|+YF--|ZF[---WF--XF]+,|-WF++XF[+++YF++ZF]-,|--YF++|++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[PenroseY]

Omega=Y

Predecessors=W,X,Y,Z,F

Successors=YF|++ZF----XF[-YF----WF]++,|+YF--ZF[---WF--XF]+,|-WF++XF[+++YF++ZF]-,|--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[PenroseZ]

Omega=Z

Predecessors=W,X,Y,Z,F

Successors=YF|++ZF----XF[-YF----WF]++,|+YF--ZF[---WF--XF]+,|-WF++XF[+++YF++ZF]-,|--YF++++WF[+ZF++++XF]--XF,

alpha=0

delta=36

Generation_Level=4

[DoublePenrose]

Omega=[X][Y]++[X][Y]++[X][Y]++[X][Y]++[X][Y]

Predecessors=W,X,Y,Z,F

Successors=Y4F++Z2F----X4F[-Y4F----W2F]++,+Y4F--Z2F[---W2F--X4F]+,-W2F++X4F[+++Y4F++Z2F]-,--Y4F++++W2F[+Z2F++++X4F]--X4F,

alpha=0

delta=36

Generation_Level=4

[ColorPenrose1]

Omega=+W2F--X4F---Y4F--Z2F

Predecessors=W,X,Y,Z,F

Successors=Y4F++Z2F----X4F[-Y4F----W2F]++,+Y4F--Z2F[---W2F--X4F]+,-W2F++X4F[+++Y4F++Z2F]-,--Y4F++++W2F[+Z2F++++X4F]--X4F,

alpha=0

delta=36

Generation_Level=4

[ColorPenrose3]

Omega=[X]++[X]++[X]++[X]++[X]

Predecessors=W,X,Y,Z,F

Successors=Y4F++Z2F----X4F[-Y4F----W2F]++,+Y4F--Z2F[---W2F--X4F]+,-W2F++X4F[+++Y4F++Z2F]-,--Y4F++++W2F[+Z2F++++X4F]--X4F,

alpha=18

delta=36

Generation_Level=4

[ColorPenroseFill]

Omega=[X]++[X]++[X]++[X]++[X]

Predecessors=W,X,Y,Z,F

Successors=Y1F++Z1F----X1F[-Y1F----W1F]++,+Y2F--Z2F[---W2F--X2F]+,-W3F++X3F[+++Y3F++Z3F]-,--Y4F++++W4F[+Z4F++++X4F]--X4F,

alpha=18

delta=36

Generation_Level=2

[CircularTile]

Omega=X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X+X

Predecessors=X,Y

Successors=[F+F+F+F[---X-Y]+++++F++++++++F-F-F-F],[F+F+F+F[---Y]+++++F++++++++F-F-F-F]

alpha=0

delta=15

Generation_Level=3

;=========================

; Other examples

[Quartet]

Omega=FB

Predecessors=A,B,F,H,J

Successors=FBFA+HFA+FB-FA,FB+FA-FB-JFBFA,,-,+

alpha=0

delta=90

Generation_Level=5

[Fern Leaf]

Omega=F

Predecessors=F

Successors=|[+++++F][-------F]-|[++++F][------F]-|[+++F][-----F]-|F

alpha=278

delta=8

Generation_Level=4

[Lace]

Omega=w

Predecessors=w,x,y,z

Successors=+++x--F--zFx+,---w++F++yFw-,+zFx--F--z+++,-yFw++F++y---

alpha=0

delta=30

Generation_Level=6

[border]

Omega=XYXYXYX+XYXYXYX+XYXYXYX+XYXYXYX

Predecessors=X,Y

Successors=FX+FX+FXFY-FY-,+FX+FXFY-FY-FY

alpha=0

delta=90

Generation_Level=3

in honor to scintist from Canada A.Lindenmayer...

Share this post


Link to post
Share on other sites

Wow, nice script Valery, thanks, a little messed, but Tidy tool can fix it :)

But i can really see how i can use it to draw a simple arrows <_<


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...