Sunday 29 January 2012

Complex Grading Boundary

I have been experimenting on trying to find a quick way to make a boundary around a complex assortment of grading and featurelines as shown below.

ryvu0npk

Basically the quickest way I have come up with to date is too.

  1. Select all featurelines in the drawing (using my SF command in a lsp)
  2. Isolate all the featureline
  3. Hide all the internal featurelines
  4. Close of the perimeter with temporary polyline as shown in white above
  5. Use the Lineworkshrinkwarp command to generate the boundary around the perimeter.

Better yet It would be good if Autodesk could make the interactive corridor boundary tool work with featurelines and polylines objects outside of a corridor to generate a boundary.

Thursday 26 January 2012

Another couple of good AU papers on Grading by David Garrigues

The reason I was looking at waybackmachine the other day was to track down the code that David Garrigues demoed in his 2008 AU paper for doing temporary work planes surface. Could not download it from the archived community site.

But found an AU site with the 2008 papers. You can download the code and video presentation which are worth a watch for those doing grading. The paper does not download for some reason.

http://test42.dcheetah.com/?nd=class&session_id=2921

Also David’s presentation from 2010 is very good

http://au.autodesk.com/?nd=class&session_id=7215

Just have to upgrade the grading code to vb.net for 2012 unless some else has and wishes to share it.

Wednesday 25 January 2012

The WayBackMachine

Sometimes websites get taken down for what ever reason and you wish you had a time machine.

Well check out the Waybackmachine remember the old Autodesk Civil Engineering Community site

http://web.archive.org/web/20080412100024/http://civilcommunity.autodesk.com/

and some of the old utilities

http://web.archive.org/web/20081222202015/http://civilcommunity.autodesk.com/content/utilities/

or Tony Tanzillo’s website

http://wayback.archive.org/web/*/http://caddzone.com

http://wayback.archive.org/web/*/http://autodesk.com

Monday 23 January 2012

Adding Scale and other Fields to Title Block

Been updating the old title block to be a bit more automatic to save sometime I insert fields into the block attributes to give me the data I wanted as follows

Insert Copyright Year
utcriayx

Insert Drawing Name 
vjqzfwvy

Inserting blanks as per link

Inserted Drawing Scale as per this video

jsvky5f3

Updated the scale bar values to update based on the scale as well

qoegg55w

 

I did look at using a diesel expression first for the scale calculation but this did not work as the object ID is turned to a number straight away and the link to the viewport is broken here are some links on diesel for future reference anyway

http://civil3d.wordpress.com/2011/08/23/quick-to-the-diesel/

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS73099cc142f4875513fb5cd10c4aa30d6b-7b3c.htm,topicNumber=d0e393837

http://www.cadforum.cz/cadforum_en/qaID.asp?tip=3676

Sunday 22 January 2012

Developer Centre VB.net tutorials

Seeing I am going off on a bit of a tangent on programming at the moment, it occurred to me that a lot of people may of not seen the Developer Centre resources for .net that include a number of labs that are design to get you started in using .net with Autocad. They are available here for those that are interested. 

Saturday 21 January 2012

Writing Object Orientated VB.net Code for Civil3D (Part 2)

Over the last 12 months I have come to the conclusion that in going from VBA to VB.net you need to start employing some software architecture and Object Orientated Programming (OOP) techniques to progress your coding projects past small routines to the next level with larger numbers of classes and greater complexity.
So over the the last few months instead of writing more code I have been investigating how to write better code. To clarify my thoughts I typically write things down so plan to do this as a number of blog postings, being self taught of course the way I think about thinks my not be strictly correct or just plain wrong. So feel free to post a constructive comments explaining things more correctly, or differently.
Now having investigated the subject I bit I have come to the conclusion that there are two ways to write code either from the bottom up or the top down.
Bottom Up MethodThis is amateur method that I have been using for a while, I have an immediate problem, know now to open the new VB.net IDE and type some traditional VB language, so can piece together some sort of working code routine.
Top Down MethodThis (i guess more professional) method works by mapping out how your code will work using Unified Modelling Language (UML) Case and Class diagrams. You could do this before starting any code and depending on what UML package you use you can generate the outline of your code automatically.
So before we can start Refractoring any code we need to understand what a Class is and what UML Case and Class diagrams are to plan our attack.
What is a Class?
From the MSDN website
“A class is simply a template of a type of object; think of it as a blueprint that describes the object. Just as a single blueprint (aka Class) can be used to build multiple buildings (aka objects), a class can be used to create multiple copies of an object.”
So what does this mean in plain English and how do we write I class in VB.net? There are a number of videos on the internet explaining classes and how they are written but these two are quite good.

VB.NET Working With Classes: OOP, Object creation and structures (1)VB.NET Working With Classes: OOP, Object creation and structures (2)

After watching the videos hopefully you have an understand what a basic class is and the power of VB.Net intellisense, its icons and drop downs in helping you write code.
One thing I have struggled with is remembering what all the little icons mean. To refresh myself I have pasted together below some screen shots off the internet to refer too.
intellisense Icons 2
What are UML Case and Class Diagrams?UML Diagrams are basically a standardised way to document the structure of your code. I have found a couple of introductory video’s on UML using the program Software Ideas Modeller, here and here by Mike Lively, he also has created a series of UML Reference Cards.
If you work through the example given by Mike you can generate the outline of the VB.net code automatically by going to the Tools menu Generate Source Code.

Below is a screen capture of the vb.net code generated.
ohjnrwts

Notes:
  1. Importing code to automatically generate class diagrams with Software Ideas Modeller currently does not work with .net version 4 or a Debug build just a Release build.
  2. NClass is another UML modeller that has less options but lets drawing diagrams with the standard vb.net icons for methods and properties.
Reference BooksVisual Basic .NET class design handbook
Head first object-oriented analysis and design

Thursday 19 January 2012

Another Interesting Grading Example

Been doing another urban infill job today here is a quick picture of the grading so far. Four building platforms in a gully with a driveway down the side and retaining walls all over the place.

Modelled with a corridor for the drive, featurelines break lines for the retaining walls and ETW from the corridor.gowing drive

Thursday 12 January 2012

Writing Object Orientated VB.net Code for Civil3D (Part 1)

At the beginning of last year I uploaded the post Visual Basic (VB) for Civil3d this post always appears to come up on my blogs statistics as one of the most popular posts.

It was my intention to post more on programming last year however I did not manage to do this as I didn’t spend much time working on my programming projects.This was partly due to lack of time and secondary lack of knowledge on how to structure my code in a better way. Anyway this year one of my resolutions is to develop my projects further.

The project I have decided to start with first is one I got going a while ago (2008-9) and posted as a wish and video. It enables you to create different types of longsections in 3 clicks or less by loading in the different Alignment, Profile and ProfileView style settings from an externally stored XML file. The reason I developed the code was to save time on small jobs drawn in one dwg. When there is a need to draw multiple small longsections of different types and styles for walls, drains, roads, etc. I have toyed with various names for the project over the years but I have decided to settle on the name “Long Section Generator” for now.

The original code was written in VBA and so far I have transferred it into VB.net in Visual Basic Express 2008 and have it running in Civil3d 2012.

Now the fun starts Refactoring.

Refactoring is the reworking of existing code to perform better and to be more maintainable using Object Orientated Design practices.

In the AU video I recommended in the previous post by Augusto Goncalves he recommends the book
Refactoring: improving the design of existing code 
which can be found on amazon at the link above or at Google books

And according to the book my code smells and it smells bad.

The reason is that previously in VBA I would sketch up a bit of a flow diagram (as below) of what I wanted to achieve. Then develop code for the flow diagram by using examples and bolt them together into a long string of routines, not the best programming technique.

So in the next post I plan to summarize some of the Object Orientated programming practices I have been reading about over the last month and while on holiday.
Image1154

Tuesday 10 January 2012

AU 2011 Papers online Interesting Programming Paper

The AU papers for 2011 are now online and I have been watching a few, found this one for the all the programmers out there about some recommended software architecture best practice which I have been reading alot about lately with the goal of trying to improve how I do things and maybe moving into doing more programming as part time enterprise.

http://au.autodesk.com/?nd=class&session_id=9129

Sharing Data with other CAD programs

Working in an Autodesk environment with Autocad based programs day in and day out you tend to hit a road block when it comes to dynamically working with others who utilise other cad programs these programs can usually only import some type of basic .dwg.

Case in point I am currently working with a landscape designer who is using Micro Station having no idea how Microstation work I have extract the basic finished surface data as cleanly as possible to include only the  featurline lines as 2d and 3d polylines the surface triangles, contours and labels as polylines and blocks.

To do this I

  1. QSelected the featurelines and wblocked them out to a new drawing.
  2. In the new drawing exploded the featurelines to just 2d and 3d polylines (as using the file export method explodes the featurelines into line segments)
  3. Then I wblocked out just the exploded lines as this gives a nice clean drawing without all the other surface information.
  4. Into this new drawing I copied and pasted the extracted surface information from the design drawing.

Hopefully this gives them a nice clean drawing with only the design information from us that they need.

Google Calendar Importing Holidays into Calendar

I bit off topic but a remainder to myself to import public holidays into you own google calendar see this link
http://www.mccambridge.org/blog/2008/03/howto-merge-google-calendars-together/

the import button is now hidden here in the new calendar layout
m3xefkp5

Thursday 5 January 2012

Happy New Year, Everyone

As most of you will of noticed (particularly those from the northern hemisphere) there as been a lack of new posts in the last couple of weeks.
That’s because Christmas in the southern hemisphere is in the middle of summer and most places shut day for a month around Christmas and New Years, post the pre Christmas rust to get projects completed.

That the case I have been spending time with the family at the holiday home next to Fleur’s Restaurant in Moeraki having beautiful weather in the middle 20’s degrees Celsius (80F), fishing, diving for crayfish and Paua and with strictly no computers.

zqomyyh3

Anyway back home for a couple of days before heading south to the family farm at Tuatapere at the bottom of the South Island to give the kids the farm experience. Wishing everyone a great year.

1fds5f45

Related Posts Plugin for WordPress, Blogger...