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:

Recommended Posts

Hi

I use Mastercam X6, Het-hook, Vb.net

 

I will draw a line, i write this code:

 

MsgBox("Draw a line")

Dim MathLine As Mastercam.Math.Line3D = New Mastercam.Math.Line3D(New Mastercam.Math.Point3D(0.0, 0.0, 0.0), New Mastercam.Math.Point3D(100.0, 0.0, 0.0))

Dim Line1 = New Mastercam.Curves.LineGeometry(MathLine)

Line1.Validate()

'ridisegno

Mastercam.IO.GraphicsManager.Repaint(True)

 

 

But the system don't draw a line.

It's an error in my code, o it's a problem in Net-hook?

 

Thanks for the answer

Link to comment
Share on other sites

Did you check the return value of this -> Line1.Validate()

If not, it is not doing you much good.

Validates whether or not the current entity object is a valid Mastercam database entry yet.

True if the entity is already in the Mastercam database and false if not.

I bet that it will be false, as you have not committed the line entity to the Mastercam database.

For any "object" you create, if you want it to be in Mastercam must be "committed".

 

Line1.Commit()

Link to comment
Share on other sites

What is the exact error you are getting?

What is in the Error Log when you build your Project?

I assume you running Visual Studio 2010

 

I just ran this C# code with X6 and it works (the line shows up on-screen) just fine -

     private bool CreateLine()
       {
           bool result = false;

           Mastercam.Math.Point3D pt1 = new Mastercam.Math.Point3D(0.0, 0.0, 0.0);
           Mastercam.Math.Point3D pt2 = new Mastercam.Math.Point3D(100.0, 0.0, 0.0);
           Mastercam.Curves.LineGeometry Line1 = new Mastercam.Curves.LineGeometry(pt1, pt2);
           result = Line1.Commit();
           result = Line1.Validate(); // Not really needed here, if Commit was successful - we're good!
           //Mastercam.IO.GraphicsManager.Repaint(True)

           return result;
       }

Link to comment
Share on other sites
  • 5 months later...

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...