CAD Program (Autocad Lite)

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
 

Attachments

  • Cad.zip
    272 KB · Views: 727
Last edited:

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...
 

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
 

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
 

Attachments

  • Cad.zip
    241.8 KB · Views: 476

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
 

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
 

klaus

Expert
Licensed User
Longtime 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:

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
 

ceaser

Active Member
Licensed User
Ok, I fixed up the parallel lines to vertical lines.

Thanks
Michael
 

Attachments

  • Cad.zip
    241.7 KB · Views: 525

klaus

Expert
Licensed User
Longtime 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.
 

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
 

klaus

Expert
Licensed User
Longtime 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.
 

ceaser

Active Member
Licensed User
Hi Klaus

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

Grusse
Michael
 

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
 

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
 

Byak@

Active Member
Licensed User
thanks for answer)
importing and exporting DXF format files is general function!Good luck
 

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
 

klaus

Expert
Licensed User
Longtime User
Hi Michael,

You should replace your code:
B4X:
[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:
B4X:
[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.
 

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
 
Top