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:

MASTERCAM API'S (net-hooks using vb.net)


Recommended Posts

TO CHAIN 3D GEOMETRY

 

Public Class Mainview2
    Public geometrymask As GeometryMask

#CODE FOR SELECTING THE 3DGEOMETRY FOR  CREATING A BOUNDING BOX

Private Sub SelectGeometry_Click(sender As Object, e As EventArgs) Handles SelectGeometry.Click
        DialogManager.YesNo("Selecting geometry", "Please select the geometry")

        SelectionManager.SelectGeometryByMask(QuickMaskType.Solids)

    End Sub

#CODE FOR BOUNDING BOX

 Private Sub Boundingbox_Click(sender As Object, e As EventArgs) Handles Boundingbox.Click


        geometrymask.Solids = True

        Dim geometrytobound As Geometry() = SearchManager.GetGeometry(geometrymask)





        SettingsManager.LineStyle = LineStyleType.Phantom


        Dim commondata As BoundingBoxCommonParams
        commondata.CreateLinesArcs = True
        Dim rectangledata As BoundingBoxRectangularParams
        rectangledata.ExpandXPlus = NumericUpDown1.Value
        rectangledata.ExpandXMinus = NumericUpDown2.Value
        rectangledata.ExpandYPlus = NumericUpDown3.Value
        rectangledata.ExpandYMinus = NumericUpDown4.Value
        rectangledata.ExpandZPlus = NumericUpDown5.Value
        rectangledata.ExpandZMinus = NumericUpDown6.Value



        GeometryCreationManager.RectangularBoundingBox(commondata, rectangledata, geometrytobound)

"Chain geometry code"

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Chainmanager.getmultiplechains("Selectchains")

    End Sub


Sir, I need your help with  this:

When I run the chainmanager. A dialog box opens which asks the user to select 2D chains, but the 3D solid chain is disabled.
I perused through ("Mastercam.Database.Types"--- Enumeration---"solidtype") and found that it has all the requisite enums I needa
for the 3D chaining operation. 

But I don't know how to pass the "solidtype" enum inside a code. 

Sir, I have attached a screen shot,  Its the 3D chaining option I am having trouble with. Can you please help?

Thanks in advance

5af560cbd3d1d_Screenshot(264).thumb.png.87db1b6fb7fffc4e72d107ac055e85fc.png

Link to comment
Share on other sites

BOUNDING BOX USING API- MASTERCAM 2018

Sir, I need your help with the bounding box  problem. I didn't see it  until recently

Firstly , I selected all the geometry present in the part file and drew a bounding a box around it.

When I checked it manually , the dimensions of the entity were not displayed on the bounding  dialog box.

I did the facing operation manually   and the toolpath formed looked great, but when I simulated it  the facing operation went awry.

 

 

I've attached 3 screenshots for  your understanding

I need your help with this  Sir.

Thanks in advance

Bounding Box:




# Selecting all  entities in the current mastercam file 

  Private Sub SelectGeometry_Click(sender As Object, e As EventArgs) Handles SelectGeometry.Click
        DialogManager.YesNo("Selecting geometry", "Please select the geometry")

        SelectionManager.SelectGeometryByMask(QuickMaskType.Solids)

    End Sub



# Button for drawing the bounding box around the block



Private Sub Boundingbox_Click(sender As Object, e As EventArgs) Handles Boundingbox.Click
        Dim view As Geometry()
        view = BB()

    End Sub




# Rectangular bounding box function
  Public Function BB() As Geometry()
        SettingsManager.LineStyle = LineStyleType.Phantom


        Dim commondata As BoundingBoxCommonParams
        commondata.CreateLinesArcs = True


        Dim rectangledata As BoundingBoxRectangularParams
        rectangledata.ExpandXPlus = NumericUpDown1.Value
        rectangledata.ExpandXMinus = NumericUpDown2.Value
        rectangledata.ExpandYPlus = NumericUpDown3.Value
        rectangledata.ExpandYMinus = NumericUpDown4.Value
        rectangledata.ExpandZPlus = NumericUpDown5.Value
        rectangledata.ExpandZMinus = NumericUpDown6.Value

        Dim geometrymask As GeometryMask
        geometrymask.Solids = True
        Dim Geometrytobound As Geometry() = SearchManager.GetGeometry(geometrymask)
        GeometryCreationManager.RectangularBoundingBox(commondata, rectangledata, Geometrytobound)


        Return Geometrytobound


    End Function

 

Screenshot (270).png

Screenshot (271).png

Screenshot (272).png

Link to comment
Share on other sites
  • 1 year later...

Hello 

I am new to mastercam API'S too.  I Write the code as below, but get an error.

code:

----------------------------------------

Imports Mastercam

Imports Mastercam.BasicGeometry

Imports Mastercam.Database

 

        Sub Test()

            Dim point As New PointGeometry(10.0, 20.0, 0.0)
            point.Commit()
       
        End Sub

----------------------------------------

Error 1 "Commit" has an unsupported return type or an unsupported parameter type.

 

The code "point.Commit()" Can't pass debugging, DId I miss something?  Can someone help?

 

 

 

 

 

 

 

Link to comment
Share on other sites

The version of Visual Studio used to build a NET-Hook doesn’t really matter. It's the "Target Framework" setting in the project that you're working with that can matter for .NET
*This is not true for C-Hooks, which must be built using the exact same version (C++ compiler toolset in a specific version of VS) that was used to build the version of Mastercam it is to run in.
Of course you’ll need to set the Reference to the proper NET-Hook API DLL that is in X6.
You can try using VS-2017 this for X6 HET-Hook add-in. It may or may not help. 
But probably not because… If I recall correctly there was an issue in VB.NET itself back then.
If you build your NET-Hook using C#, it will probably work in X6.
This is a good VB to C# converter - http://converter.telerik.com/

Edited by Roger Martin from CNC Software
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...