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: 

Creating GridSurface & Adding Points .NET

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
TerryDotson
501 Views, 4 Replies

Creating GridSurface & Adding Points .NET

I'm trying to create a gridsurface in .NET code and populate it.  I'm trying this Autodesk supplied example.

 

It appears to work on small data sets (like the 10x10 in the example) but begins to bog down significantly on anything larger than that.  I'm trying a roughly 200x200 right now and it seems to get slower with each call to .AddPoint.  It's as if the surface is being rebuilt with each addition?

 

Is there a better way to full the z-value array?  Its un-usable at 200x200 (could take hours) and that is a very small dataset!

4 REPLIES 4
Message 2 of 5

Have you tried the SetPointsElevation Method? I'm not quite sure, since I haven't worked with grid surfaces before, but I would think you'd create the outer points and then set the grid points within the surface using this method since they'd be created with the outside grid points. But I wouldn't know without trying it.Have

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 3 of 5

Looks like the SetPointsElevation Method only allows setting the elevation of multiple points to the same elevation. Odd that there is a DeletePoints() method but not an AddPoints() method.

Jeff_M, also a frequent Swamper
EESignature
Message 4 of 5
TerryDotson
in reply to: Jeff_M

I thought SetPointsElevation might be used to initialize all the values to 0.0, then use SetPointElevation to set to the actual, but no luck (error).  It appears the points slots simply don't exist until added with the .AddPoint function.  Something else I noticed that is strange is there is no way to specify the number of rows/cols with GridSurface.Create, also no way to specify the origin point?

 

Periodically I stick a toe in the Civil3D .NET water to try it out, every time it's COLD.

Message 5 of 5
TerryDotson
in reply to: TerryDotson

I believe I have found a workaround.  Here are revisions to make to the Autodesk supplied code (link above).

1) After dimensioning the GridSurface, add:
     surface.CreateSnapshot()
     surface.RebuildSnapshot()

2) After setting elevations with AddPoint:
     surface.Rebuild()

There may be other combinations of operations but this is the minimum found so far that works.  After this, the 200x200 test processed in roughly 0.25sec even on this 8 year old machine and (in the actual implementation) other larger grids load within a reasonable amount of time.

 

To workaround the lack of a .StartPoint option, create the grid then use TransformBy to move it (before committing the transaction).

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

Post to forums  

Rail Community


Autodesk Design & Make Report