Author Topic: Detect Hole  (Read 776 times)

0 Members and 1 Guest are viewing this topic.

Offline JasonCaronTopic starter

  • Active Member
  • **
  • Posts: 18
  • Country: ca
  • Gender: Male
Detect Hole
« on: Jul 12, 2021, 18:45:29 PM »
Hi ,
I was wondering if it's possible to detect a hole into a piece for a script ,all i've seen is RemoveHole did try to play with it a little but can't make it work ... Purpose of this is only to detect if a straight got a hole in it then swap into machine cut etc...

You guys got any idea or to possibly make this work ? BTW i'm far to be a master in scripting ,but learning everyday :)

Hope you guys can help ,thanks in advance !

Offline patryduf

  • Premier Member
  • *****
  • Posts: 1117
  • Country: ca
  • Gender: Male
Re: Detect Hole
« Reply #1 on: Jul 12, 2021, 19:51:33 PM »
Jason,
 If the straight has more than 3 dimensions (a,b,c) it has a hole int it.
But not if it is a dynamic hole.

You could always change option #24 in your script.
« Last Edit: Jul 12, 2021, 19:55:02 PM by patryduf »
"Whether you think you can or you can't - YOU'RE RIGHT."
"Que vous croyiez pouvoir ou non - VOUS AVEZ RAISON."

Yvon Dufresne - Novybec
CADmep, CAMduct, Revit, eVolve

Offline JasonCaronTopic starter

  • Active Member
  • **
  • Posts: 18
  • Country: ca
  • Gender: Male
Re: Detect Hole
« Reply #2 on: Jul 13, 2021, 15:08:12 PM »
Thanks for the quick answer and did try to go with the option #24 ,but it seems that it dont detect the hole and keep it to decoiler ... So i changed my mind and tryed it that way ...

Code: [Select]
function CheckHole()
if item.Option["Hole Side #1"].Value="Top" or item.Option["Hole Side #1"].Value="Bottom" or item.Option["Hole Side #1"].Value="Left" or item.Option["Hole Side #1"].Value="Right" then
item.option["Override Cut Type"].value="Machine Cut"
item.update()
end if
end function

select item.Cid
  case 866
  CheckHole()
  end select
item.update()

It is working as long as he got a hole in it and i get an error NULL Object when he dont ,to that point i'm not sure how to by pass that NULL error .

Any idea ?

Thanks for the help Mr Duf.

Offline zhenja83

  • Active Member
  • **
  • Posts: 29
  • Country: 00
  • Gender: Male
Re: Detect Hole
« Reply #3 on: Jul 30, 2021, 10:05:42 AM »
Try adding a check like this. I've tested and it no errors in both cases.
Code: [Select]
if item.Option["Hole Side #1"]
then
rem add the necessary action code here
endif