Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SampleElevation in ObjectARX application

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
393 Views, 3 Replies

SampleElevation in ObjectARX application

Hello, 

I've posted a similar thread before, but in the wrong section of the forums. User Jeff_M pointed me towards here, so I hope I've got it right this time 🙂

 

I have an ObjectARX application where I consult a TIN surface for elevation samples. I need several thousand point's elevations in a straight line. Initially, I was making thousands of FindElevationAtXY calls, but that proved to be somewhat slow, so I searched and found SampleElevation in the documentation and was hoping it'd provide me with performance gain.

 

I had some problems, due to my inexperience with VARIANT and SAFEARRAY types, but now I get what seems to be correct results when passing an initial and ending point. Here's a code snippet of my call, which succeeds and gives me the correct elevations;

HRESULT result = mTINSurface->SampleElevations(x,y,n_x,y,&variant); //sample in line

 Note that I'm sampling a line along the x-axis (y constant).

 

The problem i'm facing is that the number of samples along the line provided by the method is far smaller than I expected.  I need thousands of points along this line (in fact, I want all points with exact  round x-coordinates), and no matter what size I provide for the safe array of doubles given by 'variant', I get only a few hundred points. Furthermore, I've checked and the offset between any two points in the resulting sample is not constant, nor are they the same when I sample a different line (increase y coordinate by one).

 

Here are my questions:

  • Why are these points chosen by the method - I mean, are they chosen because they are somehow 'significant'?
  • Is there a way to specify the number of points I want along this line?
  • Would it be at all possible to determine a constant offset for the samples (i.e., I want coordinates at specific points x-units apart from each other)?

Thanks for in advance,

MS

3 REPLIES 3
Message 2 of 4
Jeff_M
in reply to: Anonymous

The SampleElevations() method gets the points where the line defined by your x/y inputs crosses the TIN lines of the surface.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 4
Anonymous
in reply to: Jeff_M

Thanks, Jeff_M! I figured something like that was going on. As I said, I'm not very experienced with these formats and any help is appreciated. I now wonder if my performance gain comes from the fact that I am really just sampling a few hundred points (instead of thousands). I'll see what I can do about it.

 

This does leave me with another question, though: when calling SampleElevation, what happens if the line defined by my x/y inputs coincides with a TIN line of my surface?

 

Thanks again,

MS

Message 4 of 4
Jeff_M
in reply to: Anonymous


@Anonymous wrote:

 

This does leave me with another question, though: when calling SampleElevation, what happens if the line defined by my x/y inputs coincides with a TIN line of my surface?

 

Thanks again,

MS


Glad I can help. That is a good question and one which I have not looked into. It shouldn't be too hard to test though. My guess is that you will get the start/end points of the TIN line and nothing in between.

Jeff_M, also a frequent Swamper
EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report