CAD Program (Autocad Lite)

Discussion in 'Open Source Projects' started by ceaser, Jun 27, 2009.

  1. ceaser

    ceaser Active Member Licensed User

    Hi Everybody

    I am attaching a small CAD program, which should be very similar to the Autocad Lite program. Things that the program can do:

    1. Open and Save a drawing. At the moment the drawings are in a "CEASER" format, but I should have the option of opening and saving drawings in a "DXF" format ready by this weekend.
    2. Under the editing you can "Undo", "Redo", "Trim Lines" and "Extend Lines"
    3. Under the lines, one can draw "Points", "Freehand", "Lines", "Polygons", "Lock Vertical", "Lock Horizontal", "Draw Parallel" and "Draw Boxes"
    4. There are a couple of circle options. With the help of Klaus:sign0188:
    5. There are lock options. Lock to "End Line", "Middle Line", "Lock to Close Point", "Lock Perpendicular", "Center of Circle".
    6. Drawing entities can be placed on different layers.

    I need help with the following::sign0085::sign0085:

    1. Scale the drawing to world coordinates
    2. Be able to scale, move, copy and rotate a drawing.
    3. All the zoom options...i.e. zoom in, zoom out, reset, etc
    4. Be able to plot dimensions to the drawing objects.

    What I am busying with:

    1. DXF import and export
    2. Enter coordinates to draw lines, circles, etc. instead of drawing them with the stylus on the screen. To draw a line one would enter the following : 120,100,20,200,300,21 (X,Y,Z,X1,Y1,Z1)
    3. A manual!!!!:BangHead:

    Thanks
    Michael

    Hi

    I am attaching an update (with Klaus's help:sign0188:) on my CAD program.

    Thanks
    Michael

    Hi

    Another update on my attempt at a mobile CAD program:(

    Thanks
    Michael
     

    Attached Files:

    • Cad.zip
      File size:
      272 KB
      Views:
      339
    Last edited: Oct 9, 2009
  2. Ariel_Z

    Ariel_Z Active Member Licensed User

    Looks good!
    As a beginner, I found myself asking myself "what should I do now?". Maybe a quick example (something simple under help menu, like "my first job" or so) will be good.

    As I opened a new site using menu command file - new site, named the site and clicked OK (on the desktop), an error "Object reference not set to an instance of an object" occured.

    Waiting to check further...
     
  3. ceaser

    ceaser Active Member Licensed User

    Hi Ariel

    Forget about the "New Site". This is used when the total program is available. Go straight to the "CAD" icon. It's the one that has a drawing board with a ruler and pen across.

    Regards
    Michael
     
  4. ceaser

    ceaser Active Member Licensed User

    Hi

    I forgot to disable certain functions when the rest of the survey modules are not available.:BangHead:

    I am posting a new zip file.

    Sorry:sign0013:

    Regards
    Michael
     

    Attached Files:

    • Cad.zip
      File size:
      241.8 KB
      Views:
      154
    khonasham likes this.
  5. Ariel_Z

    Ariel_Z Active Member Licensed User

    Hi,
    This time I got better. I started as you described and the editing form looks good.
    I did encounter a failure when I created a new job and then pressed the Field icon in the main menu (which looks great by the way). "Object reference not set to an instance of an object", line 1445


    Anyhow, there are few things I did want to suggest:
    1. Tooltips for the menus in editing mode. As there are no descriptions (and this is good in UI manner) there should be somthing saying what a menu option does.
    2. Add layer - you might want to exit automatically after adding one layer?
    3. Does the layer feature work?
    4. Does the erase layer feature work? I did not get it to work.

    Could you give me a short description of the "normal" procedure of working with the program including purpose, scenario, work flow and results? I'm afraid I'm still trying to figure out what are the entire abilities and if I get you right it is an excellent idea.

    Ariel
     
  6. ceaser

    ceaser Active Member Licensed User

    Hi Eziel

    Forget about opening a "Job". Like I said before, go straight to "CAD" . The other modules are only available in the total surveying program.

    Something I forget to mention, the "Erase" layers does not work yet, as I am not sure how I should handle it. When erasing a layer then all drawing entities on that layer should be deleted. This is a bit dangerous and other options should be looked at.

    Eziel, go to the "CAD" module and start drawing lines and then save them. I will have the chapter that explains everything ready soon.

    Regards
    Michael
     
  7. klaus

    klaus Expert Licensed User

    Hello Michael,

    I had also a look at your program and have following comments:
    - it would be interesting to see on the toolbox buttons what function or option is active, not only as text on the bottom of the screen.
    - horizontal / vertical lines, the end point red cross should be the line's end point but it is the cursor's position.
    - parallel lines, doesn't work with vertical lines.
    - it seems that the last snap function has a strange behaviour, perhaps I am missing something
    - how to display only the objects of a given layer ?
    - would it be possible to select an object and modify the point coordinates ?
    - what are the red crosses for ? when loading a drawing they are not displayed.
    - in your code you have a lot of buttons named Button100, Button101, Button102 ... it would be easyer with self explaining names like btnFileFunc, btnEditFunc, btnZoomFunc ...

    For the scaling you must introduce scaling variables to convert the pixels into world coordinates (including the zoom factor).

    For the zoom it depends if you want to draw
    - onto a bitmap and zoom and scroll this one, but eventually with memory problems
    - directly onto the form, but even for scrolling you need to redraw the whole drawing.

    Best regards.
     
    Last edited: Jun 29, 2009
  8. ceaser

    ceaser Active Member Licensed User

    Hi Klaus

    I will add the suggestions that you mentioned and also have a look at vertical parallel lines.

    To show only entities on certain layers, you need to click on the layer icon, which will then show you all the layers in your drawing. By clicking in the small box next to the layer name, a "X" will appear, which will hide the layer from your drawing. This was one of the routines that you send me some time ago.

    The last "Snap" option is to snap perpendicular to an existing line. A little square box will appear once you are close to the perpendicular point.

    Regards
    Michael
     
  9. ceaser

    ceaser Active Member Licensed User

    Ok, I fixed up the parallel lines to vertical lines.

    Thanks
    Michael
     

    Attached Files:

    • Cad.zip
      File size:
      241.7 KB
      Views:
      164
  10. klaus

    klaus Expert Licensed User

    Hi Michael,

    I tested the program a bit more and found some other points:
    - arc functions, after having drawn a first arc the next one picks up the last point from the previous arc ?
    - 4th snap function: this function looks for a point on a nearby line, it shows also points on the virtual line outsides the end points ?

    For the layers I got it. I missed the first column because when you click onto a layer name the first column is hidden, I suggest you to shorten the width of the layer column to fit within the table width.

    Best regards.
     
  11. ceaser

    ceaser Active Member Licensed User

    Hi Klaus

    Ok, I fixed the 3 Point Arc Function and also made the Table where the layers are displayed smaller.

    Regarding the zoom functions, I would like to zoom directly on the form.

    Regards
    Michael
     
  12. klaus

    klaus Expert Licensed User

    Hi Michael,

    For the zoom function you will need:
    - to check the min max coordinates of the points in world coordinates
    - a drawing surface on the screen in pixels with width and height in variables
    - a scale factor variable 1 pixel = x meters
    - 2 scroll bars to scroll the drawing on the screen
    - 2 variables for the upper left corner coordinates in world coordinates of the screen drawing surface.
    - 2 coordinate conversion routines to convert world coordinates into screen coordinates, the zoom factor can directly be included.

    In the drawing routine you must check what is visible and only draw these elements.

    Best regards.
     
  13. ceaser

    ceaser Active Member Licensed User

    Hi Klaus

    Dass ist mein problem. How do I show scrollbars on the main form???:sign0148:

    Grusse
    Michael
     
  14. klaus

    klaus Expert Licensed User

    Hi Michael,

    You can add ScrollBars with the ControlEx library on any form.

    You find an example in the ScaledMap program.

    Best regards.
     
  15. Byak@

    Byak@ Active Member Licensed User

    Nice work ceaser! i hope you complite this program)and adapt it for PC. i many work with autocad and i very want alternativ program
     
  16. ceaser

    ceaser Active Member Licensed User

    Hi Byak

    Thanks for that!

    I have finished the following:

    1. Move marked entities
    2. Copy marked entities
    3. Scale marked entities
    4. Rotate marked entities
    5. Trim and extend lines.

    I am busy with importing and exporting DXF format files and also with all the "Zoom" functions.

    As soon as I have completed this (later this week) I will post an update of the program.

    Thanks
    Michael
     
  17. Byak@

    Byak@ Active Member Licensed User

    thanks for answer)
    importing and exporting DXF format files is general function!Good luck
     
  18. ceaser

    ceaser Active Member Licensed User

    Hi

    I am posting a new version of my CAD program, but I need some help:sign0085:

    Once you have drawn a couple of entities on the screen, click on the red cross at the bottom of the screen (this will cancel any drawing commands). Next you mark some entities on the screen. This you can do as if you where drawing a box. The program will then re-color all the drawing entities black (I am working on the routine to redraw the marked entities with dashed lines). Then you select the "Rotate" function to rotate the marked entities.

    This all works fine, but when you release the stylus from the screen, the drawing is not right. There is something wrong with the formula that I am using!:BangHead:

    Can anybody help please?

    Thanks
    Michael
     
  19. klaus

    klaus Expert Licensed User

    Hi Michael,

    You should replace your code:
    Code:
    [SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]Drawing(i).X = RotX(Drawing(i).X - C, Drawing(i).Y - D, Angle) + C [/FONT][/SIZE]
    [SIZE=
    2][FONT=Courier New]Drawing(i).Y = RotY(Drawing(i).X - C, Drawing(i).Y - D, Angle) + D[/FONT][/SIZE][/FONT][/SIZE]
    by this one:
    Code:
    [FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]xx = RotX(Drawing(i).X - C, Drawing(i).Y - D, Angle) + C [/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New]Drawing(i).Y = RotY(Drawing(i).X - C, Drawing(i).Y - D, Angle) + D[/FONT][/SIZE]
    [SIZE=
    2][FONT=Courier New]Drawing(i).X = xx[/FONT][/SIZE][/SIZE][/FONT]
    You must introduce an intermediate variable, because in the 2nd equation you need the original value of Drawing(i).X and not the already modifyed one.

    Best regards.
     
  20. ceaser

    ceaser Active Member Licensed User

    Thanks Klaus:sign0188:

    How about having different line types as a library?

    My next post will have the option of opening and saving drawings in a DXF format.

    Any idea where I can look to open and save drawings in a AutoCad format(dwg)?

    Thanks
    Michael
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice