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! > CAM Software > BobCad-Cam


BobCad-Cam Discuss all BobCad software here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 06-14-2007, 01:44 PM
 
Join Date: Dec 2006
Location: USA
Posts: 46
vpcnc is on a distinguished road
Getting the X and Y of my First CAM location

I've posted this in the BCC Forums. Thought someone here might help as well.

I'm trying to make an Edit to the Way the Tool Change Macro Outputs the First X and Y position. In the Default Macro, It was Hard Coded to output an X0 and a Y0.
I've Changed it to X???? and Y???? because these always need to be changed.
What I liked to do is have the Macro Output the X and Y of the First Feature to be cut from the Cam side.
If Nothing is selected on the CAM side then it would output the X???? and the Y???? so they can be manually changed.
Example, If I'm going to Drill Holes, then I want the X and Y to be the X and Y of the First Hole location.
Here is the Modified Script/Macro as I have it now.
Fanuc0MDToolChange.bas
Code:
'Tool Parameters
OptionsUnits Output, Unit = UN
NCEdit Output,Line = i
dim XPOS as double
dim YPOS as double
dim ZPOS as double
dim TOOLNUM as integer
dim DESC as string
dim TOOLNUMSTRING as string
dim SPINDIR as integer
dim SPINSPEED as integer
dim WORKOFF as integer
SPINDIR = 3
SPINSPEED = 500
WORKOFF = 54
NCEdit Line = i, Output, X = XPOS, Y = YPOS, Z = ZPOS
Ask Header="Tool Change",Output,Cancel=canc,"Tool Number;0"=TOOLNUM, "Tool 
Description"=DESC, "Spindle Direction;0"=SPINDIR, "Spindle Speed;0"=SPINSPEED, 
"Work Offset;0"=WORKOFF
If canc Then
    Exit
End If
If WORKOFF < 54 Then
 WORKOFF = 54
End If
If WORKOFF > 59 Then
 WORKOFF = 59
End If
If TOOLNUM > 99 Then
 TOOLNUM = 99
End If
If TOOLNUM < 0 Then
 TOOLNUM = 0
End If
If TOOLNUM < 10 Then
 TOOLNUMSTRING = "0"+TOOLNUM
Else
 TOOLNUMSTRING = TOOLNUM
End If
If SPINDIR < 3 Then
 SPINDIR = 3
End If
If SPINDIR > 4 Then
 SPINDIR = 4
End If
If SPINSPEED < 0 Then
 SPINDPEED = SPINSPEED * -1
End If
XPOS = XPOS - 1
YPOS = YPOS - 1
NCEdit Line = i,Output,Text=txt
txt = "N"+TOOLNUM+"M06T"+TOOLNUMSTRING
If Len(DESC) > 0 Then
 txt = txt+" ("+DESC+")"
End If
NCEdit Line = i,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = i+1,Output,Text=txt
txt = txt+"G0G"+WORKOFF+"G90X????Y????S"+SPINSPEED+"M0"+SPINDIR
NCEdit Line = i+1,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = i+2,Output,Text=txt
txt = txt+"G43Z1.0H"+TOOLNUM+"M08"
NCEdit Line = i+2,Text=txt, X = XPOS, Y = YPOS, Z = ZPOS, Output, NumLines=nl
NCEdit Line = nl + 2, X = XPOS, Y = YPOS
NCRenumber
Window2
This is the Sample NC code that I get...
N1M06T01 (TEST)
G0G54G90X????Y????S500M03
G43Z1.0H1M08
Can anyone help with what I need to change on the Highlighted section of the Macro/Script?
Reply With Quote

  #2   Ban this user!
Old 06-16-2007, 02:01 PM
tjones's Avatar  
Join Date: Oct 2005
Location: USA
Age: 45
Posts: 851
tjones is on a distinguished road

Not sure how to read the future?

How can the script know what you will be doing next? You could put the tool change line in and then later run a script to read the position and update the x,y.

Maybe some more info would help.

Do you wish to have the script read a cad position or have the operator input the values when it runs?
Reply With Quote

  #3   Ban this user!
Old 06-19-2007, 10:16 AM
 
Join Date: Dec 2006
Location: USA
Posts: 46
vpcnc is on a distinguished road

Not sure how to read the future?
Not looking to read the future...

The Chain to be Cut has already been selected on the CAD side.
I'd like the Script to read the X and Y of the start point of the First Entity of the Chain. Then Insert that X Y in place where I have the X???? Y????.

If no Chain, or Entity is selected, then it would default to using the X???? Y????.

I've examined every script that comes with BCC and most of the scripts that I've found through various posts. I haven't been able to find the variable or codes that I need to use to do this.

I'm pretty sure that the Selected Chain would be available as an Array, but What Array? Then How do you determein if the Entity is a Point, Line or Arc?

I'm also thinking that maybe it can be done after the fact with Generate, and then go back to the first line and search for the X and Y.
Reply With Quote

  #4   Ban this user!
Old 06-19-2007, 10:47 AM
 
Join Date: Aug 2003
Location: United States
Posts: 449
The One is on a distinguished road

Try this, not exactly, it will need some formatting and changes to work in your script, but this gives you the basic idea.

NCEdit Line = i
Verify Output, NSel = NE
If NE = 0 Then
txt = X???Y???
Else
Generate
NCEdit Line = i, Output, X = xpos, Y = ypos
Undo
txt = X + xpos + Y + ypos
End If


Then do the rest. You need to generate code, so that the the system knows where X and Y are. The scripting engine does not allow you to get information from the entities directly, so we create the locations and just store them to a variable before we undo the code generation.

Regards
Reply With Quote

  #5   Ban this user!
Old 06-22-2007, 09:34 AM
 
Join Date: Dec 2006
Location: USA
Posts: 46
vpcnc is on a distinguished road

You need to generate code, so that the the system knows where X and Y are. The scripting engine does not allow you to get information from the entities directly, so we create the locations and just store them to a variable before we undo the code generation.
I'll experiment with your sample code and see what I can come up with.
If I get it working, I'll post the finished code.

Thanks, this might just be the missing info I need.
Reply With Quote

Sponsored Links
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
What is the X & Y Location Joe Crumley Commercial CNC Wood Routers 3 04-09-2007 12:42 AM
Forum Location adwsystems General Metalwork Discussion 0 05-16-2006 07:15 AM
Map your location Rekd CNCzone Club House 20 10-20-2005 09:49 PM
location mocnc DIY-CNC Router Table Machines 15 04-08-2005 04:12 PM
location? fastolds Surfcam 11 12-02-2004 01:58 AM




All times are GMT -5. The time now is 07:43 PM.





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 354 355 356 357 358 359 360 361