Alpha Video Training
Page 1 of 3 123 LastLast
Results 1 to 30 of 79

Thread: Line Drawing in Alpha

  1. #1
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Line Drawing in Alpha

    A client asked if i can convert their Microsoft Access Database to another database because of its limitation when it comes to its capacity with only 2GB, I told the client i can do it in Alpha Five, but the problem is I cannot do in alpha the feature of the access application which draws lines to become a simple map of a lot, In the application it collects data as point 1 and 2 then there is a Bearing then a distance, encoders provide the points then msaccess generates an image out of the given values. can we do this in alpha Five? say, i will enter a point 1 and point 2 then a line will be displayed, then i will specify the second point as North with BEARING and Distance then a line will be drawn.Hope someone from alpha experts show the power of alpha like the one created with MSaccess . Thank you.
    Attached Images Attached Images

  2. #2
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: Line Drawing in Alpha

    You can certainly do this in A5. You will need to look at ui_bitmap_draw(), ui_screen_draw() and ui_printer_draw() in combination with the line() function. The wiki has some code examples from which you may be able to extract code similar to what you need. Also take a look on www.learnalpha.com where I'm pretty sure there are some line drawing examples.
    Finian

  3. #3
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    I cant figure out how o use ui_bitmap_draw, pls share a sample. thank you!

  4. #4
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,805

    Default Re: Line Drawing in Alpha

    Sorry, I don't have any relevant code to share.

    A good place to start would be this page http://wiki.alphasoftware.com/Bitmap...phic+Functions where there are plenty of examples. There are code samples of how to draw rectangles and triangles and methods of rotating those objects. You'll also have to modify your existing form where you collect the map coordinates so that it conforms to A5's way of doing things.

    I'm not saying it's easy, and maybe not as easy in A5 as in Access, just that it's doable.
    Finian

  5. #5
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,842

    Default Re: Line Drawing in Alpha

    I worked with the ui_bitmap_draw to build the dynamic image found here. I would suggest you not use Alpha Five for this unless your requirements are very simple or you cannot find a suitable alternate 3rd party utility made for drawing based on your parameters.
    Last edited by Steve Wood; 01-10-2013 at 06:02 AM.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  6. #6
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Steve Wood View Post
    I worked with the ui_bitmap_draw to build the dynamic image found here. I would suggest you not use Alpha Five for this unless your requirements are very simple or you cannot find a suitable alternate 3rd party utility made for drawing based on your parameters.
    Thank you for the replies. What could be an alternative third party control to create this kind and be able to integrate it into alpha five?
    Last edited by Steve Wood; 01-10-2013 at 06:05 AM.

  7. #7
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Finian Lennon View Post
    Sorry, I don't have any relevant code to share.

    A good place to start would be this page http://wiki.alphasoftware.com/Bitmap...phic+Functions where there are plenty of examples. There are code samples of how to draw rectangles and triangles and methods of rotating those objects. You'll also have to modify your existing form where you collect the map coordinates so that it conforms to A5's way of doing things.

    Maybe you can help me on this? How is it possible to base the drawing with the sample parameters on the attached image?

    I'm not saying it's easy, and maybe not as easy in A5 as in Access, just that it's doable.

  8. #8
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    BTW, the parameters according to the client is from a land survey data.

  9. #9
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by JetLi View Post
    Thank you for the replies. What could be an alternative third party control to create this kind and be able to integrate it into alpha five?
    I don't agree with what Steve said. While you could use a 3rd party tool, it is very doable within Alpha to create a bitmap, display or print object with drawing commands within Alpha. That doesn't mean that you don't have to read the examples carefully. I use it in my CSDA Screen Capture Utility to scale images, and to draw my logo on them as a watermark for a trial version.

    You are essentially creating a bunch of alpha drawing commands as a text string, and then passing them to a function that draws them. Take a look at the sample in Set_Origin().
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  10. #10
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,957

    Default Re: Line Drawing in Alpha

    Is the entire Access database limited to 2 GIGs, or is it a single table in the database?
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  11. #11
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,047

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by martinwcole View Post
    Is the entire Access database limited to 2 GIGs, or is it a single table in the database?
    By default Access stores everything in one single file (.mdb). This single file cannot be larger than 2GB. I have read that it is possible to reference objects that reside in another mdb file. Thus allowing an Access project to extend beyond the 2GB limit.


    Disclaimer: I do not do any work in Access, I have never tested any of the above, only have read about it on the internet. However since it was posted on the internet it must be true.
    Andrew

  12. #12
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    maybe alpha can draw triangles squares circles,but, is it possible to draw from point1 to point2 in a certain degree or angle then point3 to point4 and another angle etc? like the one shown in the image, its something like a survey data then microsoft access draws the image,i tried in alpha but to no avail, please help. Thanks!

  13. #13
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,047

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by JetLi View Post
    maybe alpha can draw triangles squares circles,but, is it possible to draw from point1 to point2 in a certain degree or angle then point3 to point4 and another angle etc? like the one shown in the image, its something like a survey data then microsoft access draws the image,i tried in alpha but to no avail, please help. Thanks!

    Post 4 Finian provided a link to the Bitmap and Graphic Functions page on the alpha wiki.

    On that page there is a function called UI_SHAPE_LINETO(). Did you look at that? From a simple glance this appears to do what you are wanting.
    Andrew

  14. #14
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Yap , I tried with the given data on the image attached but could not do it,

  15. #15
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Line Drawing in Alpha

    I tried with the given data on the image attached but could not do it
    The data you show indicates line number, angle, and length.
    The line to command accepts start and end points.
    You need to translate line number, angle, and length into start and end points.

  16. #16
    "Certified" Alphaholic
    Real Name
    Andrew Schone
    Join Date
    Dec 2005
    Location
    Kansas
    Posts
    1,047

    Default Re: Line Drawing in Alpha

    UI_SHAPE_LINETO()
    Code:
    ui_bitmap_create("test", 4, 2)
    ui_bitmap_draw("test", <<%code%
    set_origin(0,0)
    inner_rect(0, 0, 4, 2)
    set_pen("black")
    set_brush("green")
    ui_shape_start_poly("five", 1.5, .4)
    ui_shape_lineto("five", 3, .75)
    ui_shape_lineto("five", 2.3, 1.75)
    ui_shape_lineto("five", 1.4, 1.65)
    ui_shape_lineto("five", .75, 1)
    ui_shape_poly("five", 1.5, .4)
    fill_shape("five", 0,0)
    %code%)
    ui_dlg_box("", "{image=test}")
    The above code is from the wiki. I tried this in V11 Build 2373 and got just a single line.
    Tried in V8 Build 1980 and got the expected graphic. I sent in a bug report.
    Andrew

  17. #17
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Stan Mathews View Post
    The data you show indicates line number, angle, and length.
    The line to command accepts start and end points.
    You need to translate line number, angle, and length into start and end points.
    May I request everyone to solve this problem in alpha Five? It's something like a coding contest, sorry, the winner will have no price, but members and alpha users will benefit from the solution.
    Last edited by JetLi; 02-22-2012 at 07:54 PM.

  18. #18
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,644

    Default Re: Line Drawing in Alpha

    I just tried this sample that Ira pointed to and it works just fine in v11 (I didn't study your example, Andrew, but I had the same problem):

    Code:
    ui_bitmap_create("test", 4, 2)
    ui_bitmap_draw("test",<<%code%
    inner_Rect(0, 0, 4, 2)
    set_pen("black", "Solid", 1)
    set_origin(2, 1)
    set_brush("green")
    start_poly(0, -.75)
    lineto(1, .25)
    lineto(-1, .25)
    fill_poly(0, -.75)
    set_rotate(30)
    set_brush("blue")
    start_poly(0, -.75)
    lineto(1, .25)
    lineto(-1, .25)
    fill_poly(0, -.75)
    %code%)
    ui_dlg_box("","{image=test}")
    Jet Li, you will have to study the graphic methods that Alpha provides. They are somewhat complex but you can do what you want. But it will require a fair amount of effort on your part.

  19. #19
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Line Drawing in Alpha

    It's something like a coding contest, sorry, the winner will have no price, but members and alpha users will benefit from the solution.
    Why don't you solve it for us?

    I told the client i can do it in Alpha Five
    You should have said you couldn't.

  20. #20
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,619

    Default Re: Line Drawing in Alpha

    'nuther approach with lots of flexibility:

    Code:
    dim instruction as c
    dim vfile as c 
    vfile = "c:\image_1.jpg"
    
    instruction = <<%a%
    convert -size 300x200 xc:lightblue -stroke darkgreen -strokewidth 2 -draw "line 5,35 195,5"%a%
    instruction = instruction + vfile
    
    flag = a5_runimagemagiccommand("", vfile, Instruction)
    sys_open(vfile)
    -Steve


  21. #21
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Steve Workings View Post
    'nuther approach with lots of flexibility:
    Which doesn't change the need to convert points and bearings to X,Y coordinates.

    The a5_runimagemagiccommand() command can do a lot, but is primarily intended for images, although it can do drawing as well. Drawback (IMHO) is that it is creating a batch program to run an external program to process the commands. I'm not sure what the speed penalty is for that sequence, but I bet it's not particularly small.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  22. #22
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Stan Mathews View Post
    Why don't you solve it for us?

    You should have said you couldn't.
    Yap sorry, i really should have said i could not do it.

  23. #23
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by Steve Workings View Post
    'nuther approach with lots of flexibility:

    Code:
    dim instruction as c
    dim vfile as c 
    vfile = "c:\image_1.jpg"
    
    instruction = <<%a%
    convert -size 300x200 xc:lightblue -stroke darkgreen -strokewidth 2 -draw "line 5,35 195,5"%a%
    instruction = instruction + vfile
    
    flag = a5_runimagemagiccommand("", vfile, Instruction)
    sys_open(vfile)
    Thank you so much for the effort,I'll try the given code, I really appreciate it very much.

    I tried the code and it draws a single green line., how do i draw another line which connects to the edge of the first line then with a certain angle another line will be drawn?
    Last edited by JetLi; 02-23-2012 at 12:57 AM.

  24. #24
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,619

    Default Re: Line Drawing in Alpha

    Jetson - I can get you started, which I have, but the next stuff, as Ira is also suggesting, is going to be up to you. While I and others may find this to be an interesting project, I don't know how much anyone will invest in it. I'll cheer anyone on who wants to do this.

    For further help and ideas, Google imagemajick.
    -Steve


  25. #25
    "Certified" Alphaholic
    Real Name
    Raymond Lyons
    Join Date
    Apr 2000
    Location
    Carlsbad, CA
    Posts
    2,143

    Default Re: Line Drawing in Alpha

    It can all be done in Alpha Five, or at least I am 99% sure it can. However, the learning curve for a relative novice to do it would be quite steep. Many years ago I wanted to produce a fairly simple chart based on data from amortization tables I generated in A5. The chart was to graphically show savings one could have by making different extra payments on a mortgage. Having zero experience with line drawing this way, it probably took me 2 solid weeks (maybe more!) to succeed but I did.

    Below is an example of the result, every bit of it drawn with the code in the text file I have also attached (you can't run the code though because prior to the code for drawing the chart there is a ton of other code that generates the needed data). I include the code just so anyone interested can see an example of how complex things can get. That said, my hunch is that what is wanted in this thread may be much easier. But no, I am not am not up to the challenge of showing anyone how to do it.

    BYW, I both showed the chart on screen and printed it, along with a cover letter.

    Raymond Lyons

    EDIT: One more possibly interesting thing about my work to produce the chart: It was done 9 years ago and through every upgrade to Alpha Five it has continued to work flawlessly through at least V 10.5, i.e., no need to fix or adjust anything due to changes in A5. But why do it in A5 when there are other easier ways (simple chart, excel, etc.)? All those other ways require that A5 continues to support those things, that upgrades to those things continue to work the same way with A5, and in the case of needed third party programs (even Excel!) that my customers have those programs or aren't put off by having to buy them--more and more people are learning that they don't really need things like MS Office. Also, with A5 I was able to automate the whole process (query to select a dozen or so records that need the letter and chart, do the processing for them, send the print job to the appropriate network color printer, record the date printed so it won't be done again, all with the push of a single button by the user once a month). Then too there is another reason to do it in A5: It is a good feeling to succeed at something that is quite challenging (at least it was quite challenging for me). I should add that my initial pay for completing the this addition to the application the chart is part of? Zero, and sadly, not a lot more since then since I have very little ambition in regard to selling things I create, and now I am 90% retired from all this stuff.

    Int_saver.jpg
    Attached Files Attached Files
    Last edited by Raymond Lyons; 02-23-2012 at 01:33 PM.

  26. #26
    VAR csda1's Avatar
    Real Name
    Ira J Perlow
    Join Date
    Apr 2000
    Location
    Boston, Massachusetts, USA
    Posts
    3,530

    Default Re: Line Drawing in Alpha

    One other thing, it may be obvious, but then again maybe not. You can hire a consultant to write code for your needs, and then incorporate that into your project. It may not be in your budget, but there are many Alpha Five consultants, myself, Steve, those listed at IADN, and many other consultants that can do that code.

    And many consultants hire each other to work on certain portions that they are less expert in.

    So that is another choice. BUT, if you have the time and ability, there is nothing better than writing your own code for satisfaction and accomplishment, as well as learning.

    Your basic 1st steps would be to take the initial point, and calculate the next X,Y position based on bearing and length. This is simple algebra and Trigonometry. Then repeat for all the rest of the points. Once you can calculate that, you then have to place those points, possibly scaled and shifted in the X and Y, onto an image using whatever method you choose.
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture



  27. #27
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    if only you are all near so that I can probably hire anyone of you, although i could not afford one but must have to earn for it, the problem is, in our country, we cannot avail of a credit card if we are poor, credit cards are for the rich here in our place, we must present to the bank our proof of monthly income, i may have some option for payment but overseas transaction are expensive, e.g. Money transer from bank to bank, the charges might be expensive than your fee to complete the code.I'll just try my lick on this one.Thank you!

  28. #28
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,644

    Default Re: Line Drawing in Alpha

    Jetli,

    People on this board will usually try to help you. But what they won't do is write the application for you. You have to study the code examples on the WiKi and do trial & error and testing. That's what all developers do. Raymond Lyons gave you a code example that you can study. Look here on the WiKi as well:

    http://alphafivewiki.com/Bitmap+and+Graphic+Functions

    Study the various functions and try the examples. These functions and methods are not particularly easy, but they are workable. But again, YOU have to do this; we won't do it for you. When you encounter a particular problem go ahead and ask a question, but don't ask someone else to do your work. Do you see the difference?

    Good luck to you!

  29. #29
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Quote Originally Posted by csda1 View Post
    One other thing, it may be obvious, but then again maybe not. You can hire a consultant to write code for your needs, and then incorporate that into your project. It may not be in your budget, but there are many Alpha Five consultants, myself, Steve, those listed at IADN, and many other consultants that can do that code.

    And many consultants hire each other to work on certain portions that they are less expert in.

    So that is another choice. BUT, if you have the time and ability, there is nothing better than writing your own code for satisfaction and accomplishment, as well as learning.

    Your basic 1st steps would be to take the initial point, and calculate the next X,Y position based on bearing and length. This is simple algebra and Trigonometry. Then repeat for all the rest of the points. Once you can calculate that, you then have to place those points, possibly scaled and shifted in the X and Y, onto an image using whatever method you choose.
    How much would it cost to hire you or your friends Ira for the code of the attached file? Thank you!

  30. #30
    "Certified" Alphaholic
    Real Name
    Jetson Lilibeth
    Join Date
    Dec 2011
    Posts
    1,093

    Default Re: Line Drawing in Alpha

    Another data.
    Attached Images Attached Images
    Last edited by JetLi; 02-29-2012 at 08:42 PM.

Similar Threads

  1. drawing table in dialog??
    By arkeshtk in forum Web Application Server v7
    Replies: 2
    Last Post: 03-24-2008, 10:59 PM
  2. Drawing on pictures
    By idoco in forum Alpha Five Version 8
    Replies: 9
    Last Post: 06-09-2007, 10:07 AM
  3. New Drawing tool?
    By Neil Terry in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-27-2003, 09:38 AM
  4. Drawing with Alpha (Proposals)
    By Jared Murray in forum Alpha Five Version 4
    Replies: 13
    Last Post: 10-31-2001, 10:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •