Sign in to follow this  
Followers 0
Pakku

3Draw Pro

12 posts in this topic

#1 ·  Posted (edited)

Hi all

First of all, please take a look at: Manadar's topic and second I want to thank him and Pythagoras for there great job(!)

so lets move on, I have created an application in autoit which give you the opportunity to draw in 3d. the whole script is based on the topic earlier in this post.

but I have changed a bit. The main thing I have changed is the inputmanager on a way that it will not be a worse application for your CPU. I also have made the GUI in onevent mode.

You can find the script in the attachment.

If you want to use (and it can) the original inputmanager.au3, just remove the "2" in the #include<> which you will find in the main loop.

In the attachment you will find my script, the original inputmanager.au3 and inputmanager2.au3 which a mod on the original inputmanger.au3.

Attachment:

http://www.autoitscript.com/fileman/users/arjan%20staring/3draw%20pro.zip

Edited by Pakku

Share this post


Link to post
Share on other sites



Looks good, I'm not sure how to use it, but you should try to fix up the resizing of the window.

Dock the controls, so that they don't move.

GuiCtrlSetResizing($control, $GUI_DOCKALL)

Elsewhere it's not a bad script

:whistle:


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

nice program... :whistle:

Share this post


Link to post
Share on other sites

Looks good, I'm not sure how to use it.

Nor do I, can you explain how to use it, arjan staring

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Interesting start :-)

But I think I found some strange behavior (for the Z axe)

this is my axe.3dp

[coordinates]
0=3
1=0,0,0-0,0,20-0x0000FF
2=0,0,0-0,20,0-0x008000
3=0,0,0-20,0,0-0xFF0000
[center]
x=200
y=200

the X axe is red

the Y axe is green

and the Z axe is blue

but when I load and play with it I found that your coordinate system

put X axe left to right

put Y axe bottom to top

put the Z axe going from the screen to the back ... ???

You should have put the Z axe in the other direction to have a normal set of coordinate.

:-)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

hi,

its very simple

first you put in the coordinates of the x, y and z and the end coordinates of the x,y and z.

you can fill this in in the 6 inputboxes (can't be difficult) the choose a color (hit "select color" button) the color you choose will be displayed in the label next to it (just for showing the color) then hit the "add" button.

in the list box, you have to select the coordinates you want to display. then nothing will happen but when you hit a key (numpad 4 for example' and then it will show you your `images`.

when you haven´t select one in the list, it wil show you an other image, this is to display you how it will look like.

is it all clear to you now.

@eynstyne

what do you mean, cause i don't use that, could you explain what you mean?

@JoeCool

please take a look at my first post, you will see a url which will send you to the basis of this script. it has all to do with that.

@all

please call me just Arjan (does someone know how to change my nickname?)

Edited by Pakku

Share this post


Link to post
Share on other sites

What I mean is that your buttons shift on top of the grid you are trying to draw on when you resize the window using that thing in the bottom right corner. It looks sloppy, so you could just use the $GUI_DOCKALL

style for each button control on the right side of your program.

e.g:

$label = Guictrlcreatelabel("I'm a label",50,50,100,20)
guictrlsetresizing($label, $GUI_DOCKALL) ;<--- The control, when the window is resized will stay put and not shift around and stuff...

:whistle:


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

hi,

i see, thanks!

this will solve the big problem.

EDIT:

this is what the script with the changes

but it is still the same'.

what went wrong?

#include <GUIConstants.au3>
#include <Misc.au3>
#Include <GuiList.au3>
#include <3D.au3>

Opt("GUICloseOnESC",0)
Opt("GUIOnEventMode",1)
Opt("OnExitFunc","close")
Opt("RunErrorsFatal",0)


$gui = GUICreate("3Draw Pro 1.0", 800, 600, 0, 0, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_OVERLAPPEDWINDOW + $WS_MAXIMIZE)
GUISetOnEvent($GUI_EVENT_CLOSE,"close")

GUICtrlCreateGroup("File",610,5,180,45)
guictrlsetresizing(-1, $GUI_DOCKALL)
$neuw = GUICtrlCreateButton("New",615,20,50,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($neuw,"_new")
$open = GUICtrlCreateButton("Open",675,20,50,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($open,"_open")
$save = GUICtrlCreateButton("Save",735,20,50,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($save,"_save")

GUICtrlCreateGroup("Center position",610,50,180,90)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("X:",615,65,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("Y:",615,90,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$center_x = GUICtrlCreateInput("",635,65,150,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetData($center_x,200)
$center_y = GUICtrlCreateInput("",635,90,150,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetData($center_y,200)
$center_set = GUICtrlCreateButton("Set center position",615,115,170,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($center_set,"_center_set")

GUICtrlCreateGroup("Coordinates",610,140,180,225)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_list = GUICtrlCreateList("",615,155,170,80,BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_add = GUICtrlCreateButton("Add",615,230,80,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($cor_add,"_cor_add")
$cor_del = GUICtrlCreateButton("Delete",705,230,80,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetOnEvent($cor_del,"_cor_del")

GUICtrlCreateLabel("X:",615,260,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("Y:",615,285,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("Z:",615,310,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("<->",700,265,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("<->",700,290,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlCreateLabel("<->",700,315,20,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_x1 = GUICtrlCreateInput("",635,260,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_y1 = GUICtrlCreateInput("",635,285,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_z1 = GUICtrlCreateInput("",635,310,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_x2 = GUICtrlCreateInput("",720,260,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_y2 = GUICtrlCreateInput("",720,285,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_z2 = GUICtrlCreateInput("",720,310,60,20)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_color = GUICtrlCreateButton("Select color",615,335,80,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
$cor_color_show = GUICtrlCreateLabel("",705,335,80,25)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUICtrlSetBkColor($cor_color_show,0xFFFFFF)
GUICtrlSetColor($cor_color_show,0xFFFFFF)
GUICtrlSetData($cor_color_show,0xFFFFFF)
GUICtrlSetOnEvent($cor_color,"_cor_color")

GUISetState()

$graphicgui = GUICreate("",600,600,0,0, $WS_CHILD + $WS_BORDER, "", $gui)
GUISetBkColor(0x000000)
$GraphicControl = GUICtrlCreateGraphic(0,0,600,600)
guictrlsetresizing(-1, $GUI_DOCKALL)
GUISetState()

_3DSetCenter(200,200)
Draw()

GUISetState()

If $CmdLine[0] > 0 Then
    _open2($CmdLine[1])
EndIf

While 1
    #include <InputManager2.au3>
WEnd

Func Draw()
    GUICtrlDelete($GraphicControl)
    $GraphicControl = GUICtrlCreateGraphic(0,0,600,600)
    guictrlsetresizing(-1, $GUI_DOCKALL)
    $ret = _GUICtrlListGetSelItemsText($cor_list)
    If (Not IsArray($ret)) Then
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR,0xFF0000)
        _3DMove(-1,0,0,0)
        _3DLine(-1,0,100,0)
        
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR,0x00FF00)
        _3DMove(-1,0,0,0)
        _3DLine(-1,100,0,0)
        
        GUICtrlSetGraphic(-1, $GUI_GR_COLOR,0x0000FF)
        _3DMove(-1,0,0,0)
        _3DLine(-1,0,0,100)
    Else
        For $i = 1 To $ret[0]
            $grof = StringSplit($ret[$i],"-")
            ;$grof[0] = 3
            ;$grof[1] = beginpunt
            ;$grof[2] = eindpunt
            ;$grof[3] = kleur
            GUICtrlSetGraphic($GraphicControl, $GUI_GR_COLOR,$grof[3]) ;kleur
            
            $beginpunt = StringSplit($grof[1],",")
            ;$beginpunt[0] = 3
            ;$beginpunt[1] = x
            ;$beginpunt[2] = y
            ;$beginpunt[3] = z
            _3DMove($GraphicControl,$beginpunt[1],$beginpunt[2],$beginpunt[3]) ;beginpunt
            
            $eindpunt = StringSplit($grof[2],",")
            ;$eindpunt[0] = 3
            ;$eindpunt[1] = x
            ;$eindpunt[2] = y
            ;$eindpunt[3] = z
            _3DLine($GraphicControl,$eindpunt[1],$eindpunt[2],$eindpunt[3]) ;eindpunt
        Next
    EndIf
    
    GUICtrlSetGraphic(-1, $GUI_GR_REFRESH)
    
    Sleep(50)
EndFunc

Func close()
    Exit
EndFunc

Func _center_set()
    _3DSetCenter(GUICtrlRead($center_x),GUICtrlRead($center_y))
    Draw()
EndFunc

Func _cor_add()
    $cor_list_add = GUICtrlRead($cor_x1) & "," & GUICtrlRead($cor_y1) & "," & GUICtrlRead($cor_z1) & "-" & GUICtrlRead($cor_x2) & "," & GUICtrlRead($cor_y2) & "," & GUICtrlRead($cor_z2) & "-" & GUICtrlRead($cor_color_show)
    _GUICtrlListAddItem($cor_list, $cor_list_add)
EndFunc

Func _cor_del()
    $ret = _GUICtrlListGetSelItems($cor_list)
    If (Not IsArray($ret)) Then
        
    Else
        For $i = 1 To $ret[0]
            _GUICtrlListDeleteItem($cor_list, $ret[$i])
        Next
    EndIf
EndFunc

Func _cor_color()
    $color = _ChooseColor (2,GUICtrlRead($cor_color_show))
    If @error Then
    
    Else
        GUICtrlSetBkColor($cor_color_show,$color)
        GUICtrlSetColor($cor_color_show,$color)
        GUICtrlSetData($cor_color_show,$color)
    EndIf
EndFunc

Func _new()
    _GUICtrlListClear($cor_list)
    GUICtrlSetData($cor_x1,"")
    GUICtrlSetData($cor_x2,"")
    GUICtrlSetData($cor_y1,"")
    GUICtrlSetData($cor_y2,"")
    GUICtrlSetData($cor_z1,"")
    GUICtrlSetData($cor_z2,"")
    GUICtrlSetBkColor($cor_color_show,0xFFFFFF)
    GUICtrlSetColor($cor_color_show,0xFFFFFF)
    GUICtrlSetData($cor_color_show,0xFFFFFF)
    GUICtrlSetData($center_x,200)
    GUICtrlSetData($center_y,200)
    GUICtrlDelete($GraphicControl)
    $GraphicControl = GUICtrlCreateGraphic(0,0,600,600)
    _3DSetCenter(200,200)
    Draw()
EndFunc

Func _save()
    $ret = _GUICtrlListGetSelItemsText($cor_list)
    If (Not IsArray($ret)) Then
        MsgBox(0,"3Draw Pro","You have to select the coordinates which you want to save")
    Else
        $tosaveto = FileSaveDialog("4Draw Pro save dialog","","3Draw Pro files (*.3dp)",18)
        If StringRight($tosaveto,4) = ".3dp" Then
            $tosaveto = $tosaveto
        Else
            $tosaveto = $tosaveto & ".3dp"
        EndIf
        If FileExists($tosaveto) Then
            FileDelete($tosaveto)
        EndIf
        IniWrite($tosaveto,"coordinates","0",$ret[0])
        For $i = 1 To $ret[0]
            IniWrite($tosaveto,"coordinates",$i,$ret[$i])
        Next
        IniWrite($tosaveto,"center","x",GUICtrlRead($center_x))
        IniWrite($tosaveto,"center","y",GUICtrlRead($center_y))
    EndIf
EndFunc

Func _open()
    $fileopen = FileOpenDialog("3Draw Pro open dialog","","3Draw Pro files (*.3dp)",3)
    _open2($fileopen)
EndFunc

Func _open2($fileopen)
    _3DSetCenter(IniRead($fileopen,"center","x",200),IniRead($fileopen,"center","y",200))
    GUICtrlSetData($center_x,IniRead($fileopen,"center","x",200))
    GUICtrlSetData($center_y,IniRead($fileopen,"center","y",200))
    $ret = IniRead($fileopen,"coordinates","0","1")
    For $i = 1 to $ret
        _GUICtrlListAddItem($cor_list, IniRead($fileopen,"coordinates",$i,"0,0,0-0,0,0-0"))
    Next
    Draw()
EndFunc
Edited by Pakku

Share this post


Link to post
Share on other sites

When i put in this:

0<>10

0<>0

0<>10

white

I can't see a line being drawn.. Is this supposed to happen? I don't see any code that should display a line. Anyway, the dutchy's know best when it comes to 3D programming :whistle: , let me know when you have this right.

Share this post


Link to post
Share on other sites

hey looks cool..

would be really neat if you could draw with the mouse, and set the size of the line, maybe in the near future? :whistle:

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@Manadar

well you have to hit a key (e.g num 4) and then you will see you line.

did you like the main idee of my script and that i used yours?

@WTS

great idee

Edited by Pakku

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Yea i really like the idea of building a editor for this kind of thing. I would also love to see the full and functional save/load-mechanism working. Just take a look at some professional 3D-editors and try to copy that using my library.

In short: The main idea is great!

Edit: The inputmanager is a clone of the one nfwu uses

Edited by Manadar

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  
Followers 0