CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > OpenSource CNC Design Center > Coding


Coding Post your Coding for opensource projects here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-26-2007, 04:22 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,608
dertsap is on a distinguished road
Buy me a Beer?
vb mass math calculation

i 'm new to this vb stuff , ive been working on a small program that works along side of inkscape , i import a bitmap into inkscape ,trace it and save it as a latex file , then i copy and paste the latex file into my program and it produces gcode , the problem i am facing is i have no control over the dimensions inkscape saves the file as , so what i need to do is a mass division of all the numbers so that i can scale down the gcode to the size that i want to be cutting at
is it possible to do this , i have searched the net over and over again but i cant find anything showing how to divide all the numbers by 100 or so .

so far the code simulates well but my machine isn't big enough to cut something that is 1024" x 780"

any input would be greatly appreciated
Tweet this Post!Share on Facebook
Reply With Quote

  #2  
Old 10-26-2007, 07:27 PM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

Are you running vb.net?


.
Tweet this Post!Share on Facebook
Reply With Quote

  #3  
Old 10-26-2007, 09:33 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,608
dertsap is on a distinguished road
Buy me a Beer?

i'm running visual basic 2008 express edition
Tweet this Post!Share on Facebook
Reply With Quote

  #4  
Old 10-26-2007, 10:51 PM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

Give me a few min., I'll throw something together.


.
Tweet this Post!Share on Facebook
Reply With Quote

  #5  
Old 10-26-2007, 11:02 PM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,608
dertsap is on a distinguished road
Buy me a Beer?

ah
your a good Man !
ive been beating my head against the keyboard trying to figure this out

i think its going to be a great lil app once its all completed , ive just got to get past the learning curves
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6  
Old 10-27-2007, 12:36 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

Well I can't find the source I have, I had a similar project a while back, I know I have it I just can't find it on my pc. I've got about 1000 diff. files that are all source code for vb.net 03 & 05.

I did post a sample code of how to use "Replace" (vb.net 2005), it should work with your 2008.

I'll keep looking for the code I planned on posting.

As far as what your trying to do, will your file have numbers & letters (X,Y,Z)?



.
Attached Files
File Type: zip Change_Code.zip‎ (58.8 KB, 35 views)
Tweet this Post!Share on Facebook
Reply With Quote

  #7  
Old 10-27-2007, 01:16 AM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,608
dertsap is on a distinguished road
Buy me a Beer?

the numbers will have have xyz , they start off as line to curve to and i convert them overto g1 xyz , heres more or less what ive done to this point ,ive included a test latex file , i open the latex file and copy and paste it into the converter , i still need to figure out how to deal with the curves , right now they are g1 moves
Attached Files
File Type: zip converter.zip‎ (443.4 KB, 33 views)
Tweet this Post!Share on Facebook
Reply With Quote

  #8  
Old 10-27-2007, 01:26 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

This might help with the division & decimal.

This code will also Format the numbers so you can specify how many decimal places in each direction (left/right) you want the numbers to be, so you don't end up with numbers like 123.123456789


Add a button & a textbox to a form, then double click the button while in the designer, that will open up a new click event for the button in the text editor of vb.net, then copy & paste the code below into that new click event that vb.net created, then run your program & click the button.





Dim D1, D2 As Decimal
D1 = 10
D2 = 0.7

TextBox1.Text = Format(Decimal.Divide(D1, D2), "##0.000")





.
Tweet this Post!Share on Facebook
Reply With Quote

  #9  
Old 10-27-2007, 01:51 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

The first thing that needs to be done in the sample (.tex) that you posted is to strip all the stuff you don't need down to only the stuff you can use in your g-code.


.
Tweet this Post!Share on Facebook
Reply With Quote

  #10  
Old 10-27-2007, 01:59 AM
dertsap's Avatar
Gold Member
 
Join Date: Oct 2005
Location: canada
Posts: 3,608
dertsap is on a distinguished road
Buy me a Beer?

i strip down some of the stuff within the converter ,but i still have a few more garbage lines to pull out of the generated gcode ,im not sure how to outright delete them so ive replaced them with a line space , which i will need to figure out how to close them up at a later time , i still need to add a textbox for z moves and stuff ,
its this mass division of all the numbers that has me stumped
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #11  
Old 10-27-2007, 02:46 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

Try this, you need a richtextbox & a button. Put this code in the button click event, run your program, then enter a number in the richtextbox with decimal (123.123). Then press the button.

Your answer should be 24.6246 at the top of your form/project.

Dim d2 As Double

d2 = richtextbox1.Text

d2 = d2 / 5

Me.Text = (d2)

.
Tweet this Post!Share on Facebook
Reply With Quote

  #12  
Old 10-27-2007, 02:58 AM
Switcher's Avatar
Moderator
 
Join Date: Apr 2005
Location: Vectorink.com
Posts: 3,659
Blog Entries: 2
Switcher is on a distinguished road

I forgot to format the number.


Dim d2 As Double

d2 = richtextbox1.Text

d2 = d2 / 5

Me.Text = Format(d2, "##0.000")
.
Tweet this Post!Share on Facebook
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mass-cnc Job Opportunity mkmk123 Employment Opportunity 2 09-18-2007 06:58 PM
Mass software? bdrmachine Mechanical Calculations/Engineering Design 9 01-19-2007 02:33 PM
Need CNC Machinists in MASS StarCatcher Employment Opportunity 20 10-27-2006 02:14 AM
Looking for small shop space - NE Mass or SE NH InspirationTool Mentors & Apprentice Locator 1 03-20-2006 07:27 AM
mass produced skeetboy25 I.C. Engines 4 08-11-2003 08:47 PM




All times are GMT -5. The time now is 12:43 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353