Ad

Thursday, October 25, 2012

Full Size Plans

I dislike full size plans. I think it’s the worst part of being an engineer. Rolling them up is a pain. If you walk and take public transportation as often as I do keeping them nice and un-sweaty is a worrisome issue. I’d much rather look at the plans on a computer, tablet, or half size. Unfortunately plan checkers insist of full size plans.

Now that I’ve built up large format printing, you might want to know that Epson has released a new line of large format printers. I don’t have room for one, but maybe you do. Check out their website for more information.

http://www.epson.com/cgi-bin/Store/jsp/Pro/Home.do

http://www.epson.com/cgi-bin/Store/jsp/Pro/SeriesSureColorTSeries/Overview.do?BV_UseBVCookie=yes

Monday, October 22, 2012

Adding PVIs to a Profile

Adding a PVI to a profile is relatively easy. There are some checks you will have to do. For instance you have to make sure the PVI station is within the alignment’s station range. Also you can’t add the second PVI with a lower station value then the first one. I think that’s about it. Here’s a small code snippet showing how it’s done:

Profile profile = profObjId.GetObject(OpenMode.ForWrite) as Profile;
double sta = 5;
double elev = 6;
profile.PVIs.AddPVI(sta, elev);

Monday, October 15, 2012

Rounding

Expressions can be hard, especially when you want to do hard things. Sometimes you may want to round to the nearest 0.1%, but show two digits. Not sure why one would want to do that, but if you did here’s an example of an expression that will do such a thing.

(ROUND({Pipe Slope}*10))/10

If you want the nearest 0.5% then this expression should work:

(ROUND({Pipe Slope}*2))/2

Happy expressioning.

Friday, October 12, 2012

Point Creation COM Style

Here is an example on how to create a point in Civil 3D using COM. To duplicate this feat, download the Civil 3D Reminders Pack. Right click on a folder, maybe the Points perhaps? Then choose create new class. Give the class a classy name. Then paste the code below into the class, replacing all of the items. Change the class name to match the file name.

Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AECC.Interop.Land
Imports Autodesk.AECC.Interop.UiLand
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Geometry
Imports Quux.C3DUtilities

<Assembly: CommandClass(GetType(PointCreation))>

Public Class PointCreation

<CommandMethod("CreatePointExample")> _
Public Sub HelloWorld()

Dim oCivil As New AeccAppConnection

Dim newPoint As AeccPoint
Dim dLocation(0 To 2) As Double
dLocation(0) = 0
dLocation(1) = 0
dLocation(2) = 0
newPoint = oCivil.AeccDoc.Points.Add(dLocation)

End Sub

End Class



If you don’t want to use the Civil 3D Reminders Pack make sure to download the Quux free edition and use a reference to it to get the AeccAppConnection to make it easier to get the Civil 3D document.

MLeader Direction

Adding multileaders to a drawing is fairly easy, one tricky item that isn’t quite evident is how to set the direction of the mLeader, where the mleader goes from left to right or right to left. In order to do this we can check the start point and the end point of the leader. In the small code snippet below I’m creating a vector that goes from left to right, if the start point to end point shows I need to go in the opposite direction then I make a vector to reflect this.

                        MLeader mld = new MLeader();
int ldNum = mld.AddLeader();
int lnNum = mld.AddLeaderLine(ldNum);
mld.AddFirstVertex(lnNum, poly.GetPoint3dAt((int)selectedPolyVertexParam));
mld.AddLastVertex(lnNum, endPt);

Vector3d vecDir = new Vector3d(1, 0, 0);
if ((endPt.X - poly.GetPoint3dAt((int)selectedPolyVertexParam).X) < 0)
{
vecDir = new Vector3d(-1, 0, 0);
}
mld.SetDogleg(0, vecDir);



Then the code sets the dog leg based on that direction. In my example I only have one leader, but if you have more you will need to make sure you apply the dog leg to the correct leader, rather then the first one in the code above.

Wednesday, October 10, 2012

Selecting an Object

Usually when you want the user to interact in selecting an object you want them to select a particular type of object. You don’t want to trust their ability to read the command line. In order to do this you can restrict what type of object AutoCAD will allow to be selected.

PromptEntityOptions opt = new PromptEntityOptions("\nSelect polyline near vertex to label: ");
opt.SetRejectMessage("\nObject must be a polyline.\n");
opt.AddAllowedClass(typeof(Polyline), true);
ObjectId polyObjId = ed.GetEntity(opt).ObjectId;



To do this use the PromptEntityOptions to add allowed classes. The hard part I usually come across is finding the class name. To easily discover the class name we can use the typeof() method passing the object type, in the case above Polyline. AutoCAD will then restrict what’s returned to this class type.

Saturday, October 06, 2012

Excel Grouping

Occasionally I spy something on screens that I haven’t seen before. I was recently in a meeting and noticed some graphics on the side of the screen in Excel. It was most certainly a feature I hadn’t learned about before.

image

Well it turns out it’s a feature that lets you group rows or columns together. It’s defintely a feature I wish I knew about before today. The feature is really easy to use to.

To start select the rows or columns and then press the Group button located on the Data Tab of the Ribbon.

image

The grouping may have multiple subgroupings. I see using this feature quite a bit now that I know about it.

LinkWithin

Blog Widget by LinkWithin

Ad