Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Deleting entities with VBS functions


Recommended Posts

Hello,

 

I have a problem with deleting entities using VBS function DeleteEntity().

The problem is that after deleting elements they still remain on the screen.

 

To put it a little different: the elements are deleted from the database (I can not select them with a cursor...), but their image still remains on the screen.

The use of screen repaint doesn't help.

The only thing that erases these "phantom" elements from the screen is the RAM SAVER. I don't like this method because it takes too much time on the bigger models.

 

Is there any better way to totally delete entities from the screen.

 

Here is a sample of my code:

code:

 

Sub Brisanje()

 

Dim bRet, level

Dim intelementCount

Dim objShell

 

Set objShell = CreateObject("WScript.Shell")

 

UnselectAll()

 

bRet = StartDBSearch(mc_alive, mc_linetype)

 

If bRet Then

Do While bRet

level = GetEntityLevel()

bRet = GetEntityEptr()

if level = 10501 then

DeleteEntity(bRet)

end if

bRet = NextDBSearch

Loop

Else

ShowString("There is no elements on the screen!")

End If

' Call RunMastercamCommand("RAMSaver")

' objShell.SendKeys "{ENTER}"

' objShell.SendKeys "{ENTER}"

End Sub

Link to comment
Share on other sites

Tried this, but unsuccesfully.

 

I also tried a Call RunMastercamCommand("OnScreenRegenerate"), but the function opens a YES/NO message. User must then click the YES button in order to continue the run of the script.

This is not OK for me - I want to run it automaticly.

 

All I want is to delete all elements from certain level (for instance level 10501)!

 

Thanks for help.

Link to comment
Share on other sites

Try this out:

 

code:

Sub Brisanje()

Dim iRet, iLevel

 

 

UnselectAll()

 

iRet = StartDBSearch(mc_alive, mc_linetype)

 

If iRet Then

Do While iRet

iLevel = GetEntityLevel()

iRet = GetEntityEptr()

 

If iLevel = 10501 Then

If Not (DeleteEntity(iRet)) Then

ShowString "Unable to delete entity: " & iRet

End If

End If

 

iRet = NextDBSearch

Loop

Else

ShowString("There are no elements on the screen!")

End If

 

Call RepaintScreen(False)

End Sub

HTH

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...