Drawing Program

colin9876

Active Member
Licensed User
tres belle!

some very nice features, great icons too
also well organised programming style, very nice

but
1 - data structure is over complex, why do u need an array count of how many lines a point belongs to and then an array indexing those other lines?

In my mind u should only need array x1(),y1(),x2(),y2(),color()
incidentaly u would also need someway to store a floodfill. this can be done using the line format with the extra provision that if say x2,y2 =(-999,-999) then there is a floodfill done at x1,y1

2- too much screen taken up by those lovely icons - many like set up, load save etc dont need to be taking up screen area all the time
 
Last edited:

Rioven

Active Member
Licensed User
Longtime User
Klaus, it's very nice start!

2- too much screen taken up by those lovely icons - many like set up, load save etc dont need to be taking up screen area all the time

I am a heavy AutoCAD user for years and always better to have large screen.
For me, to have dropdown-like buttons and on a click, then panel appears with several related buttons will save a lot of space on PPC.(just a suggestion).

zoom.jpg
 
Last edited:

Rioven

Active Member
Licensed User
Longtime User
floating textbox inputs

Guys,

Can you consider this kind of input to guide users and to have more drawing space?

line-circ.jpg


just a thought..:)
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Hi,
I am back from my 4 days journey, and can answer your posts.

I know that the data structure seems being somewhat complex.
But my reasons are the following:
I want to know:
- for each point, the lines it belons to
- for each line, the points that define the line and the surfaces it belongs to
- for each surfac, the lines that define it.
For modifications it's much more easier with this data structure.
From the user's point of view, I want to be able to select either a surface, a line or a point and modify the parameters.
If you define a polyline and click onto one of the intermediate points, it will be displayed in red with it's coordinates, that means it is selected. If now you point onto this point again and drag it at another place, the point and it's 2 adjacent lines will be moved because I know what lines belong to this point. I don't have to check all lines if that point belong to another one. In that case a same point belongs to 2 lines.

For the floodfill, there is the parameter full or hollow and this is handled in the drawing routine.

For the number of icons I completely agree with you, there are too many permanently on the screen. A first step in improvement is in the second version.

Rioven, I will take into account your suggestios, some are partly in version two. I am not shure what is the best for the user, having icons at the left permanently with a smaller display, like the lines icons, or having a dynamic menu, like surface icons, in that case there will be one mouse click more to select a new function ? But there will for sure be other improvements when using the program in reality, not only testing. I have never realy used a CAD program myself on a 'daily' base, so of course any suggestions are welcome.

The scaling and zooming are not done yet, neither grid and magnet , these will be the next steps.

Thank you both very much for your comments and suggestions.

Best regards.
 

Attachments

  • CAD_0_2.zip
    47.9 KB · Views: 360
  • CAD_02.jpg
    CAD_02.jpg
    19.4 KB · Views: 313
  • CAD_01.jpg
    CAD_01.jpg
    21.1 KB · Views: 311

dennishea

Active Member
Licensed User
Hi klaus, Hope your trip was fine.

1) is there a way to touch the spot you want to move and input the relocation manually?
2) somewhere along the way could you explain how your data collection works? I have no experience working with array's and very much would like to.
3)on manual input will there be a way to input absolute and or relative?

Your cad is heading in the right direction.

:sign0188: :sign0188: :sign0188:

:)
 

klaus

Expert
Licensed User
Longtime User
Hi dennishea,

1) Yes, if you select a point, it's coordinates are displayed in red in x0 and y0. There you can modify the values and click on the checked button on the right. At the moment it works correctly only with lines.

3) At the moment only absolute, will look to add relative. I hadn't even thought about it.

2) You can imagine arrays like tables, like in Excel. Let's define an array
Dim Array1(10,10)
This represents a table of 10 lines and 10 columns. The numbering begins with 0. So we have line 0 to line 9, the same for the columns 0-9.
If I assign a the value A(2,3)=12 that means that the value in row 3 and column 4 is equal to 12. It would have been the same if you wrote 12 in the cell in lineB and column 3 in Excel.

Explanations about the data structure.
The program knows points with following variables:
PntNb current number of points
PntX(a) x coordinates
PntY(a) y coordinates
PntCol(a) color of the point
PntLineNb(a) number of lines the point belongs to
PntLineI(a,b) indexes of the lines the point belongs to
etc.

PntX(3)=23 means that the x coordinate of point 3 is equal to 23
PntY(3)=-45 means that the y coordinate of point 3 is equal to -45

The program knows lines with following variables:
B4X:
LineNb        current number of lines
LineType(a)   line type  Ex: horizontal line, vertical line, polyline etc.
LinePntNb(a)  number of points defining the line
LinePntI(a,b) indexes of the points definig the line.
LineCol(a)    color of the line
Example:
When you draw at first a straight line you define point 1 and point 2 the two end points of the line.
So
B4X:
PntNb=2          current number of points=2
LineNb=1         current number of lines =1
LineType(1)=cLine = 1    line type straight line =1
LinePntNb(1)=2   there are 2 points in line 1  
LinePnt(1,1)=1   the first point of line 1 is point 1
LinePntI(1,2)=2  the second point in line 1 is point 2
And
PntLineNb(1)=1   point 1 belongs to only 1 line
PntLineI(1,1)=1  point 1 belongs to line 1
PntLineNb(2)=1   point 2 belongs to only 1 line
PntLineI(2,1)=1  point 2 belongs to line 1

When you draw a second line, an arc with 3 points (not yet implemented)
B4X:
PntNb=5         current number of points
LineNb=2        number of lines 2
LineType(2)=cLineArc=5
LinePntNb(2)=3  there are 3 points in the line (line 2)
LinePntI(2,1)=3 first point in line 2 is point 3
LinePntI(2,2)=4 second point in line 2 is point 4
LinePntI(2,3)=5 third point in line 2 is point 5
And
PntLineNb(3)=1  point 3 belongs to only 1 line
PntLineI(3,1)=2 point 3 belongs to line 2
PntLineNb(4)=1  point 4 belongs to only 1 line
PntLineI(4,1)=2 point 4 belongs to line 2
PntLineNb(5)=1  point 5 belongs to only 1 line
PntLineI(5,1)=2 point 5 belongs to line 2
if now you draw a polyline with two lines it becomes:
B4X:
PntNb=8         3 points more
LineNb=4        2 lines more
LineType(3)=cLinePoly=4
LinePntNb(3)=2  line 3 has 2 points
LinePntI(3,1)=6 first point of line 3 is point 6
LinePntI(3,2)=7 second point of line 3 is point 7
LineType(4)=cLinePoly=4
LinePntNb(4)=2
LinePntI(4,1)=7
LinePntI(4,2)=8

PntLineNb(6)=1  point 6 belongs to 1 line
PntLineI(6,1)=3 point 6 belongs to line 3
PntLineNb(7)=2  point 7 belongs to 2 lines
PntLineI(7,1)=3 point 7 belong to line 3
PntLineI(7,2)=4 point 7 belongs also to line 4
PntLineNb(8)=1  point 8 belongs to 1 line
PntLineI(8,1)=4 point 8 belong to line 4


And so on, similar with the surfaces.

I hope this has become more clear for you, if not let me know.

Best regards.
 

dennishea

Active Member
Licensed User
Hi klaus.
I really appreciate your time in helping me understand array's or maybe I should say us in the forum having trouble with this. Between your explanations and a saved text file and trying to relate the two I will be a step closer. The reason I asked about absolute and relative is I work with auto cad lite an old 95 version. When I draw a tool it's easier to use relative in some instances. Well I want to finish reading the other posts in the forum and get to bed. I know I have other questions as you progress with the program so will be back. Have a nice day what's left of it and may trouble never find you. :)
 

maXim

Active Member
Licensed User
Longtime User
Hi Klaus,

Your work is great!

The CAD procedure is written very well and is an excellent solution for educational purposes.
:sign0188:

P.S. At the link below the file for translation into Italian.
 

Attachments

  • CAD_I.txt
    677 bytes · Views: 290

Rioven

Active Member
Licensed User
Longtime User
AutoCadlite drawing

Hi Klaus, welcome back.
I am not sure what is the best for the user, having icons at the left permanently with a smaller display, like the lines icons, or having a dynamic menu, like surface icons, in that case there will be one mouse click more to select a new function ?
Not only for drawing space, there will be more functions or icons to be added for the future updates on the app to draw faster, the additional mouse click may be compensated. It is nice that the button menus will close when clicked, like on your polygon icon.

I've played with the app. and it is taking a great shape.
I know that you are still on structuring object records.

Here are other thoughts you may consider in cad:

1)
Drawings like AutoCad:

You already have the drawing polylines button...and this is actually only needed in drawing lines, polylines and polygons in cad.

Only needs one toggle button when 'ON' that force for horizontal/vertical('ortho')lines, 'OFF' for diagonal lines.

Drawing process is exactly what it has now :point by point by point... and only require to terminate is by following option:
a)CHECK button to end the line or polyline.
b)by another set of dropdown icons or context menu and these are the "END POINT", "MIDPOINT',"PERPENDICULAR", "NEAREST","INTERSECTION", "QUADRANT', "TANGENT"and so on.

Manual input in AutoCAD: line length, and angle(starts 0deg at due East and anti-clockwise for positive angle).

2)
For editing drawings:

The drawing objects on your app can be picked and that's amazing. It turns blue to red.
I suggest that these POINTS should be in other color(maybe green) and these will be used as 'GRIPS' and manipulate objects by using menu at b) of 1) above.

Some basic CAD Edit menu are,
COPY object
DELETE object
MOVE object
TRIM object
EXTEND object
OFFSET object
ROTATE object
SCALE object

BREAK object(splitting line objects-can be added later )
ARRAY LINEAR and ARRAY POLAR(can be added later)

3)
Dimensioning and annotations.

Future challenge.

And that's completes the cadlite ppc version.

For me object color format is not so important at the moment can be added later.


I am not on the code yet, I am still at drawing functionalites.

Once again, it is great that your looking at this Klaus.:sign0188:

THANKS!
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Ciao maXim,
Mille grazie per il testo in italiano, will be added in the next release. I hope I can rely on you for the additional texts that will be added as the program progresses.

Hi Rioven,
Thank you for your suggestions. Some of those I had also in mind but with your comments it has become much more clear to me. I had in mind for manually adding or modofying point coordinates and lines to let the choice between absolute coordinates and relative x and y distance and distance and angle.

How does the END POINT function work ? Does it mean add a new point with a line? I think that MID POINT means adding a point somewhere in a line, or does it really mean adding a point in the middle of a line ?

The other functions like COPY MOVE etc are clearto me, but what do you mean with TRIM and EXTEND is it for example shorten or lenthen a rectangle ?

I agree with you, the color is not that important, but I wanted having at least the parameter in the structure.

Unfortunately in the next days there will be almost no progress, I will have some people at home.

Hi Dennishea,
Some more comments on the data structure, it was somewhat late last night and I forgot some more explanations.
This 'complex' data structure is manly useful, for the drawing functions. If I want to draw a polygone, I have its index and all it's other parameters are known with the crossreference variables. I directly know what lines, even of different type, define the polygone and what points with their coordinates define these lines. Also for the searchin function, when I found a point I know it's index and also know what lines it belongs to and the lines what surface they belong to. It doesn't take much time nor memory to keep these parameters but it save a lot in searching and drawing.

Best regards.
 
Last edited:

Rioven

Active Member
Licensed User
Longtime User
Hi Klaus,
How does the END POINT function work ? Does it mean add a new point with a line? I think that MID POINT means adding a point somewhere in a line, or does it really mean adding a point in the middle of a line ?

The other functions like COPY MOVE etc are clearto me, but what do you mean with TRIM and EXTEND is it for example shorten or lenthen a rectangle ?

so much time difference in time on our location and can't reply at once.

The END POINT are those points where the mouse down when drawing the lines, polylines and arch and user should pick this point by targeting the point or near the end of line.

NEAREST is picking point or mouse down anywhere on the line or arch.
MIDPOINT is should be exactly at middle(or half-1/2) of line or arch.


The TRIM is if two object overlayed each other and you want to cut and clear whichever intersects. These applied in all objects, curve or lines.
For example you draw an 'X' this is two diagonal lines, and you want to clear or trim one leg, the procedure is:when TRIM button is pressed a message or text appear and ask user to pick cutting object and then pick the object to trim.

The EXTEND is like if you have drawing for example like this, l+ (vertical straight line and a plus) and you want to extend the arm of plus(+)to touch the l(vertical line) the procedure is: Press EXTEND button, message or text ask user to pick the object where to extend and this is the 'l' then message appear and ask user to pick near end of the line or arc to extend.

The shorten or lengthen the rectangle can be edited or modified by the 'GRIPS' I have mentioned earlier.
I did not include the STRETCH command on Edit Menu as can be done by grips(maybe later version)

Hope this clarifies your queries.


Thanks & Regards,
 
Last edited:

Rioven

Active Member
Licensed User
Longtime User
Hi Klaus,

My thoughts on this very 'complex' data structure is that, each object has its own dynamic data record not only for basic geometry parameters, object format(ie. color, line types) but also records of all influenced by other objects during drafting and editing when these other objects became connected or established relationship like they have shared common end, and/or intersection points. Is this also you are after?

some other suggestions:
The fill on objects can be added later, as this is not so important for the lite cad function.

The grid also is not frequently used in practical drawing or drafting(maybe added function later)

The setting up of the data structure is the most important.

Regards,
 
Last edited:

colin9876

Active Member
Licensed User
need help on foreground feature

I agree with the above comments re the importance of the best data structure - simpler the better, but on a seperate point ...

Question - is to possible to stretch the circles, rectangles etc out from a point, and to draw and erase them on the foreground as it gets bigger.
I dont want the enlarging object to erase whats underneath it as it is erased and redrawn while being dragged to shape.

e.g. the diagram so far is on the background, the newest circle etc expands on the foreground, then leaves the final circle on the background - however it doesnt destroy the background as it was being sized

UPDATE - did it, quite easy just set form1.forelayer=true and transparency colour up, and it works. Expanding objects dont erase whats on the background! I think this foreground function will be very useful when scaling objects
 

Attachments

  • CircleExpand.sbp
    768 bytes · Views: 308
Last edited:

colin9876

Active Member
Licensed User
desktop v device

new demo posted below - u can actually size the objects with the mouse! Circles, Lines, Rectangles ...

I had to change the device version so it didnt draw everywhere when run on the desktop (due to Mousemove differences)

The reason its different because on the device Mousemove only works when the stylus is down, but on the desktop the Mousemove is activated everytime the cursor moves on the window.
I think any differences between desktop and device are bad news for convergent codeing. Ive always believed that the desktop version should run same as device (this is after all primarily a ppc development tool)

Erel do u agree with my thought on this? - personally I would like to see this issue adressed in v7 ?
I.E> the default mousemove should only trigger an event when the mouse is down, like on the device the stylus has to be down to register anything. Having to detect whether the prog is running on PC or device, and then using diffent code is a shame
 
Last edited:

dennishea

Active Member
Licensed User
keyboard

:):sign0188::)
OK I switched to the device to see what functions on it and what doesn't. In the process have found things to think about.

1) keyboard
The sip control at bottom is uncontrollable. It gets covered up at times and other times it covers up angle text at bottom.
2) Instead of text boxes I believe cad used a single box and you entered your coordinates with numbers and delimiters.(Rioven I know would be one of the people to ask for that syntax)

Also I am using a Dell Axim X50 so on the sip control I don't know if that applys to everybody, some or just me.

I think you are doing an excellant job klaus.
 

klaus

Expert
Licensed User
Longtime User
Hi Rioven,
Thank's for the explanation, it's more clear now. There are sometimes different terms used to say the same thing that's the reason of my questions. I will look to implement these functions. Two are already in my, not yet released, last version.
I agree with you with the grid function, even in drawing programs I mostly disable it.
For the data structure I will need some more consideration. At the moment I use line type and surface type, perhaps I should change it to object type for both. As an example the difference between a polyline and a polygone is not that big, the second one has just two parameters more, it's closed and has a surface.
What about auxiliary lines. I remember having used a CAD program to design houses, I used it for my new house, where they used auxiliary lines, displayed over the whole screen and personally I found those very useful. There are horizontal lines, vertical line on given precise positions, parallel lines at a given precise distance and so on, this was more usefull than a grid.

Hi colin9876,
Thank you for your suggestions and examples.
For shure I don't intend to complicate the data structure unnecessarily without, what I think, good reasons to do so.
Of course there must be a display to show the evolution when defining or modifying an object. The ForeLayer function is absolutly clear to me, if you look at the code it is partially in there. I had already used it in the IconEditor. The problem I have is that I don't draw directly on the form but on an image object on a panel which is very easy to use for scrolling a bitmap bigger than the screen. BUT unfortunatly the form ForeLayer is hidden by the image object. I have not yet asked if there is a possibility to bring the ForeLayer to Foreground, I was more concentrated on the other functions, but this will for shure be an issue.

Best regards.
 

colin9876

Active Member
Licensed User
more..

Updated version with shapes and colors and Fill
 

Attachments

  • ShapesColoursDesk.sbp
    2.8 KB · Views: 305
Last edited:

Rioven

Active Member
Licensed User
Longtime User
Hi All,

Here are what I know on basic CAD drawing procedure and this already could achieve lots of drawings.

Draw LINE

1)Line button click,
2)message1: input 1st point
a) pick any point
b) or textbox input: 50,20 (define x,y coordinate)
c) or menu input: END/MID/CENTER/ POINTS etc. from other object.
d) or snap on grid​

3)message2: input 2nd point
a) pick any point(for just sketching)
b) textbox input: 500<45 (length and angle)
c) or textbox input: 50,100 (define x,y coordinate)
d) or menu input: END/MID/CENTER/ POINTS etc. TO other object.
e) snap on grid

f) WHEN 'ORTHO'button is ON (force to draw horizontal or vertical lines)
f.1)textbox input: 100
-mouse pick any point towards direction.

f.2)pick anypoint(for just sketching)
4)Check button click to end.



Draw POLYLINE

Follow 1) to 3) and repeat 3) over and over but message shows: input 3rd,4th,...point.
follow 4) to end.


Draw CLOSE POLYGON

follow draw polyline
a)to close: textbox input: C (closing the polyline)
b)or menu input: use END POINT TO the very start of the polyline in order to close polygon.
follow 4) to end


I am using AutoCAD and Rhino, they have almost similar procedure as above.
Hope the above procedure can be a guide for this app.

Hi Klaus,
The fill is called 'HATCH' on CAD, and it functions like what is on your Icon Editor. Therefore surface on closed polygon can be disregards. Please correct me if I'm wrong.


Regards,
 
Last edited:

klaus

Expert
Licensed User
Longtime User
Hi dennishea,
I had also seen the problem with the SIP on the device, will be changed !

Hi Rioven,
I will look further with your sequences for drawing lines, I am thinking of an additional possibility wich is picking up an existing point with it's known coordinates.

Thank you both and Best regards.
 

Rioven

Active Member
Licensed User
Longtime User
Hi Klaus,
Hi Rioven,
I will look further with your sequences for drawing lines, I am thinking of an additional possibility wich is picking up an existing point with it's known coordinates.
The menu input: END/MID/CENTER/INTERSECTIONS point etc. is picking the known coordinates.

EDIT: Hi Klaus, are you refering feature like the 'magnet' ? The magnet is a shortcut or automatic of these menu input: END/MID/CENTER/INTERSECTIONS point etc. which computer tells you first if the mouse is near your target point before mouse pick-a later version added feature in autocad (a good drafting option that can turn ON/OFF)
 
Last edited:
Top