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

The problem i face at the moment is that i have to "cut" a 3-dimensional model into several pieces and than display these levels as a 2-dimensional graphic. It would be enough get the highest/lowest x/y-coordinates for contructing a nice 2D-rectangle.

My idea was to set a constant for the z-value steps (e.g. 20mm means that the program has to make the first operation at: z=20 and the next at z=40 etc.) and to get the x/y- coordinates for each z-value.

It is in fact pretty easy but i havent made i myself by now because i simply lack of knowledge of how to do it in Mastercam X2... And i havent found something similar in this forum, either.

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

Im still confused about how to realize this but I have at least an idea.

 

Lets make the problem easier: I have created a Solid. Still I need the coordinates of it. But now I only need the greatest and the smallest x/y coordinates.

 

The first step is "copied" out of the NetHookExampleVB8 - supportsearchManager file:

 

code:

Dim SolidMask as GeometryMask = New GeometryMask(False)

SolidMask.Solids = True

 

Dim FoundSolidGeometry() as Geometry = searchmanager.GetGeometry(SolidMask)

But im not sure which kind of information are saved in FoundSolidGeometry. Instead of "GetGeometry" Ive tried "GetSolidGeometry", too, but still I dont know where to find the information im looking for.

Link to comment
Share on other sites

Pokemon,

 

What you get back from the GetSolidGeometry() method is an array of SolidGeometry objects. The origin of a SolidGeometry object is in the BasePoint member variable. So, you could access the origin of each solid object like this...

 

code:

        Dim FoundSolidGeometry() As SolidGeometry = SearchManager.GetSolidGeometry()

Dim SolidItem As SolidGeometry

Dim SomeValue As Integer = 2

 

For Each SolidItem In FoundSolidGeometry

If SolidItem.BasePoint.z > SomeValue Then

' Do Some stuff...

Else

' Do Some different stuff...

End If

 

Next

Hope that helps...

Link to comment
Share on other sites

Lets imagine Ive created a pyramid. Its basement is a rectangle (x=20, y=20) and its high is z=40.

I am only working with one SolidItem.

 

Ive tried sth like this:

 

code:

  

Dim SolidItem As SolidGeometry

Dim SomeValue As Integer = 100

Dim High as Integer = 0

 

For SolidItem In FoundSolidGeometry

Do

If SolidItem.BasePoint.x < SomeValue Then

SomeValue = SolidItem.BasePoint.x

End If

High += 10

Loop Until High = 40

Next

Now what I hope to get would be at least x = 0.

But in the steps when the variable high gets higher I expect to get this (just an example!):

 

High.....SomeValue

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

0...........20

10..........15

20..........10

30...........5

40...........0

(Sorry! Dont know how to add spaces...)

 

But this doesnt work confused.gif Is the BasePoint member variable maybe the wrong variable to work here with?

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

Pokemon,

 

I've read (and reread) what you're going for here, and I think I'm starting to understand what you're trying to do. More importantly, I think I'm beginning to figure out why the above code isn't working for you.

 

It looks as though the code you've written above assumes that the BasePoint is somehow changing as you loop through and increment High. However, that's not the case. Conceptually, the BasePoint is like the anchor of a solid. So it's never going to change unless you actually move the solid. In the case of a pyramid, that BasePoint is going to represent the center point of the base.

 

Pokemon, it sounds like what you REALLY want is a way to take a 2D slice of a solid (and maybe other geometry as well) at a given Z-Depth - I assume for the purposes of creating a reference image or something? Assuming that's the case, I think trying to do it manually through the API probably isn't the easiest way to go about it. Let me know if that's really what you're looking for, and in the meantime I'll see if I can talk to some people here to try and figure out the best way to get what you're looking for.

 

I'll get back to you in a bit...

Link to comment
Share on other sites
  • 4 weeks later...
  • 2 weeks later...

I'm not much help in the programming aspect but i have a idea maybe worth thinking about. How about if you create a line looking from the front view at a height you want to cut at. Then project a curve on the solid from that line. Now you have 2D geometry that can be analyzed. Sorry if this doesn't help i didn't know if you thought of it or not.

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