Ad

Sunday, November 12, 2017

Civil 3D API Wishlist

My Civil 3D API Wishlist. Feel free to add your wishes in the comments.

  • Expressions – Ability to apply them to label component properties. These include, but are limited to, text height, line length, block scale, rotation angle, X Offset, Y Offset, Maximum Width, Gap, Fixed Length, Angle, Start Point X Offset, End Point X Offset, Start Point Y Offset, End Point Y Offset, and anyone that I missed.
  • Profile View Bands – Ability to get a label by station.
  • Profile View Bands – Labels having properties applicable to what they are labeling. Such as Station, Offset, Curve Length, etc… (Maybe a way to get the available properties in the UI in a method call).
  • Profile View Bands – Pipe Network – Ability to add invert elevations to the band at Structure Walls (inside and outside).
  • Survey Database – Finish it (or probably start it) for .NET. Have the ability to everything in the UI in the API.
  • Pressure Pipe Network – Document it in the other portion of the API as well as finishing it. Have the ability to everything in the UI in the API.
  • Data Shortcuts – Add the ability to create a reference.
  • Data Shortcuts – Add the ability to change the current Data Shortcuts Working Folder (without using the XML hack).
  • Data Shortcuts – Ability to create data shortcuts for use in other drawings.
  • Feature Lines – Fix the add PI method to work correctly. Currently it appears to find the closest point and will put the PI in the wrong location.
  • Surface Analysis – Lighten up on the rules on when analysis are added to the rows. I should be able to create a long list, even if not applicable to the current surface. This way the code could be run easier.
  • Surface Analysis – Add the missing analysis types to the API.
  • Point Label Location – Fix it so you can apply the current location without having to reset with each property change. Currently it moves relative to the last location.
  • Profile – A method to find the currently selected profile view based on profile selected.
  • QTO – Create an API so it can be expanded and easily assigned to objects. Ability to extract the data from the drawing(s).
  • Profile – Allow for the station to be before or after the end of the alignment. The exception that is provided here is not productive. Especially when the station is 1+01.999 and the user wants to use 1+02.00.
  • Intersection – Allow the API to create an Intersection.
  • Linked Alignments  – Allow the API to create.
  • Linked Profiles – Allow the API to create.
  • UDP – Make more robust to changes.
  • Parcels – Finish the .NET API.
  • Subassemblies – Allow for the cleanup of the properties window after a subassembly is swapped out with a new one.

Tuesday, October 17, 2017

Style Changes

Have you ever wanted to change styles quickly? Maybe you want go from OldStyle to NewStyle, but don’t want to do it manually. Well here is maybe one way to quickly change styles for lots of objects using a LispFunction. A LispFuntion allows Lisp to talk to .NET.

In this case we can use fancy inheritance to set the style name of any object type we want. We do this by using the fact that most Civil 3D objects are a type of Autodesk.Civil.DatabaseServices.Entity which contains the StyleName property. Luckily this property takes a string and Civil 3D takes care of finding the correct style to use based on the name given. If the style isn’t in the drawing an exception will occur and an error message sent to the command line.

After loading the dll you can then type at the command line:

(ChangeCivil3DStyleByName “AECC_ALIGNMENT” “OldStyleName” “NewStyleName”)

Then press enter. Then each alignment with the OldStyleName will be magically changed to the NewStyleName. If you have lots of objects to change I’d build a list in Excel with the appropriate object type and style names and use the Concatenate formula to build the above lines. Then you can add it to a lisp or copy and paste at the command line.

To get the object type names (like AECC_ALIGNMENT), select the object and then type List at the command line. The first line should give you the value.

public class StyleChanges

{

     [LispFunction("ChangeCivil3DStyleByName")]

     public void ChangeStyleName(ResultBuffer rbArgs)

     {

          if (rbArgs == null) {

          Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nNo objects passed");

     }

     var rbArgsList = rbArgs.AsArray().ToList();

     if (rbArgsList.Count() != 3)

     {

          Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nNeed three objects to be passed.");

     }    

     try

     {

          var civDoc = CivilApplication.ActiveDocument;

          var objectType = rbArgsList[0].Value.ToString();

          var oldStyleName = rbArgsList[1].Value.ToString();

          var newStyleName = rbArgsList[2].Value.ToString();

          // Aec.DatabaseServices.Entity

          var doc = Application.DocumentManager.MdiActiveDocument;

          var ed = doc.Editor;

          using (var tr = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())

          {

               // Need to get the objects

               TypedValue[] vals = new TypedValue[]

               {

                    new TypedValue((int)DxfCode.Start, objectType)

               };

               var res = ed.SelectAll(new SelectionFilter(vals));

               if (res.Status == PromptStatus.OK) { foreach (ObjectId objId in res.Value.GetObjectIds())

               {

                    var aecObj = objId.GetObject(OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Entity;

                    if (aecObj.StyleName == oldStyleName)

                    {

                         aecObj.UpgradeOpen();

                         aecObj.StyleName = newStyleName;

                    }

               }

         }

    tr.Commit();

}

}

catch (System.Exception ex) { Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nError: " + ex.Message); } } }

Tuesday, August 15, 2017

Property Set Formulas

Sometime in the recent past Autodesk enabled and advocated the use of Property Sets. It’s kind of sad why Autodesk did this, but that is another story about the lack of BIM in Civil 3D. I recently learned one can create formulas in the Property Sets and use VBScripts in the formulas. We can then use these scripts to extract information from objects. In this post I’m going to show how you can create a script to show a Pipe’s Material.

The first step is to type PropertySetDefine at the command line. This will bring up the Style Manager. image

Right click on the Property Set Definitions and select the New option. I’m using the default name of New Style. In the script I will want to use the ObjectID of the object. Note that this ObjectID is different than ObjectId found in .NET. To add this property click on the Applies To tab of the Property Set Definition select Pipe.

image

Then press the Add Automatic Property Definition button and select Object ID from the list.

image

We will need this property in the script. So now we can create a script. Note that if you don’t want to see the property in the Properties palette you can check the Visible check box to unchecked.

image

Now press the Add Formula Property Definition button. Then Right Click, in the Insert Property Defintions, on the ObjectID and select Insert. This will add the ObjectID to the formula box and in the Enter Sample Values list.

image

Next insert the following formula in the formula box. Remove the [ObjectID] from the previous step. Make sure each line

RESULT="—"

On Error Resume Next

Set oApp=GetObject(, "AutoCAD.Application")

Set oCivilApp=oApp.GetInterfaceObject("AeccXUiLand.AeccApplication.11.0")

Set obj=oCivilApp.ActiveDocument.ObjectIdToObject("[ObjectID]")

RESULT=obj.PartDataRecord.FindByContext(300).Tag

If the text ends up large press OK and then go back into the dialog box. This will reset the text height to the default size. Then go into the drawing and apply the property set by selecting a pipe and pressing the Add Property Set button.

image

Then the Material name should show up in the box.

image

You can find the list of standard Context here: http://blog.civil3dreminders.com/2016/03/freaking-context-values.html if you want to use a different value.

Here is a video showing the steps: https://www.youtube.com/watch?v=v97WpUgk0w8

Saturday, July 22, 2017

Some Tips

This post won’t make sense unless you want to add a block at each circle and then to go back in and renumber the blocks.
Renumber blocks Lisp from Cad Forum powered by CadStudio.
Lisp Function to add a block at selected circles. (Based on this post)
To load the lisp functions for Mac.
To create blocks with attributes for Mac.

Another renumber lisp that should work on Macs. The first one doesn't work since VLX isn't supported on Macs.

Tuesday, July 18, 2017

Migrate Settings

So you want to migrate settings according to this AKN article. Unfortunately Civil 3D doesn’t include the shortcut as indicated in the file. The easy way to run the Migrate program is to navigate to the program and run it directly.

The location of the program is here:

C:\Program Files\Autodesk\AutoCAD 2018\AdMigrator.exe

If you want the same experience as the article you can follow these steps:

  • Right click on the desktop and choose New, then Create Shortcut.
  • A dialog box should pop up where you can enter the location of the item:
    C:\Program Files\Autodesk\AutoCAD 2018\AdMigrator.exe
  • Press Next and give the shortcut a name and press finish.
  • Select the newly created shortcut, right click and go to properties.
  • In the Target box enter in the string:
    "C:\Program Files\Autodesk\AutoCAD 2018\AdMigrator.exe" /product "C3D" /language "en-US"
  • Copy and paste the shortcut to start menu where it should be located in the AKN article.

Tuesday, May 16, 2017

Statistics Tab

This post shows how to get the Statistics Tab back in Windows File Properties. The first step is to type Default Programs at the Windows Start Menu.

image

Then select Choose default apps by file type.

image

Then select the AutoCAD DWG Launcher as the app to launch DWG files.

image

Now the Statistics Tab will show up.

image

Sunday, April 30, 2017

Setting the Working Folder and Data Shortcut Project

Well a long time request has been to have the ability to set the working folder and/or data shortcut folder in Civil 3D via a code solution. Well after a long exhaustive search on how to even get the current working folder and data shortcut folder I’ve finally figured out the secret handshake.

The first thing to do is read the text file that contains the Working Folder and Data shortcut information. It is stored at:

C:\Users\Christopher\AppData\Roaming\Autodesk\C3D 2017\enu\Project Management\ShortcutFolders.xml

Replace Christopher with the current user’s name and 2017 with the current version of Civil 3D. There are plenty of examples online on how to read and process XML files, so I will leave that part out of this post.

Then modify the contents of the file, here is my current file contents.

<?xml version="1.0"?>
<WorkingFolders>
    <WorkingFolder path="C:\Users\Christopher\Documents\Delete" current="-1">
        <ShortcutFolder path="C:\Users\Christopher\Documents\Delete\Blah" desc="TestDescription" current="-1" uuid="Blah-0BF7567C-C01F-43dc-BA3B-93F604ACDFBD"/>
        <ShortcutFolder path="C:\Users\Christopher\Documents\Delete\asdf" desc="" current="0" uuid="asdf-F1F190A5-253C-4edc-A3C0-038919899515"/>
    </WorkingFolder>
    <WorkingFolder path="C:\Civil 3D Projects" current="0"/>
    <WorkingFolder path="C:\Civil 3D Projects\" current="0"/>
</WorkingFolders>

Change the current=”0” to current=”-1” to indicate which working folder and data shortcut you want current and set the current=”0” for the data that you no longer want current.

Then save the file.

In Civil 3D run the REFRESHSHORTCUTNODE command at the command line and Civil 3D will read the XML file and update Civil 3D to the current state of the XML file.

Note that this workflow isn’t foolproof. If you have two instances of Civil 3D open they will both updated the XML file. This leads to problems of order if you are reading the file trying to figure out what the current working folder and data shortcuts folder is current.

Monday, April 03, 2017

Missing Layer State Icons

I’ve found that I was missing the Layer State Icons in the Layer Properties.

image

Now I rarely use the buttons now that I work on mainly small projects. But sometimes I do find it comes in handy to save layer states, especially when working with older drawings. So to get the missing layer state icons back I had to collapse the filters panel and then the icons show up.

image

Once collapsed and re-expanded the layer state icons stay visible.

Unfortunately, the change doesn’t stick, and the next time you restart AutoCAD you have to do the steps again.

Tuesday, March 07, 2017

Draw Order Based on Layer

I just found a new command to me. I suspect it's been in Civil 3D for a while. While it doesn't solve the issue of things being in the wrong draw order, it does provide a way to quickly put things in the correct draw order by layer. The command is called aeclayerorder (LayerOrder also works) and is an AutoCAD Architecture command. Civil 3D is built on top of AutoCAD Architecture so it has the command.
Here is the help file of the command:
https://knowledge.autodesk.com/support/autocad-...
Essentially type aeclayerorder at the command line and then order the layers in the list to the desired order. The layers you want to be on the bottom go to the bottom of the list. Then pressing OK will reset the draw order of objects. So easy to control draw order by layers!

Before, hatch is in front of line:

image

After, hatch is behind line:

image

Once the layers are ordered it takes like 3 clicks to get everything back in order.

Civil 3D–Hardware Evaluation NVIDIA Quadro P2000

So the question is has hardware finally caught up with poor Civil 3D architecture?

It appears that it has. I recently went to Stanford University, Center for Integrated Facility Engineering, to test out newly available hardware. NVIDIA has recently released a new line of video graphics based on the Pascal architecture and I was able to get my hands on a new P2000 video card.

SNAGHTMLa1af8a

The Center for Integrated Facility Engineering studies BIM and other related topics. The researcher, Forest Olaf Peterson, I was working with is interested in BIM and workspace planning in relation to Heavy Civil Construction.  The data set is a from a project modeled from a Caltrans project in Merced County that includes a bridge, retaining walls, ramps, and mainline reconstruction. The purpose of the research was to see how well modeling could be used to do workspace planning.

image

To start we need a benchmark of testing. I’ve got a fairly recent Dell Precision Laptop (7710) with an older NVIDIA Quadro M3000M. Using the same data set I’m seeing worse performance than I saw with the new graphics card. The drawing took longer to open and navigating the model ended up with more pauses and freezing. My laptop has a XEON CPU E3-1505M v5 @ 2.8GHz which uses turbo to increase the CPU up to 3.4 GHz.

20170302_142415

The data set is quite old. It was started around 2013 and at the time computers had a hard time keeping up. The researcher tried out numerous video cards, computers, memory, and settings to try to get something to work. Unfortunately he spent more time waiting on Civil 3D then doing his actual research.

The video card was tested on a rebuilt computer. It had an older AMD FX-9590 @ 4.78 GHz processor on a new mother board, new memory, and a bigger cooling system. The performance was decent. The drawing opened in a relatively quick time of 1 minute and 30 seconds. The panning and zooming was improved over my laptop. There still was the freezes that occur in Civil 3D, but it was manageable to navigate the model without much of a headache. The researcher noted that performance was way better than previous hardware setups. Here is a video of the computer in action.

Here is a link to the computer specifications.

20170302_171814

Overall the new video card performed well, better than I expected. I expected no change and was pleasantly surprised that it performs so well.

Also while I was there was a server that had been setup to try out some new technologies. The specs for the server is located here. The server setup is a bit pricey at about $35k, but it provided improved performance. The server is a SuperMicro Superserver 1028GQ-TRT + 4xM60 Design with  2x E5-2699 V4 2.2Ghz 22Core CPUs, 256GB Memory, 2x Intel S3520 150GB SSD SATA, 4x NVidia M60, DP 10GB Ethernet, 2P 8GB FC HBA, 3 Year Warranty. The server provided improved performance over the workstation. At the time of testing there was only one user on the server, so there might be some degradation of performance at full load. The server was less laggy and had improved navigation ability. Here is a video of the server in action.

The NVIDIA Tesla M60 video card in the server is based on a different technology than the NVIDIA Quadro P2000.

The video cards come out starting this month at OEM suppliers. I might see about upgrading my card when it becomes available more widely.

Note NVIDIA supplied me the P2000 video card without charge. One of the occasional benefits of being a blogger.

Monday, March 06, 2017

Monday, February 27, 2017

Profile View Stationing

Often times when we try to use a profile view with exacting numbers we get something that looks all jumbled up at the end of the profile view like this:

ProfVIew

Now we obviously don’t wan that. So to fix this we have to ditch the profile view style and use a profile view band instead. So the first step is to turn off the major and/or minor station labels for the bottom of the profile view.

Instead we want to use Bands to show the station information at the bottom of the profile view. Then we can set up the Band Style to show the major and minor station values. In the Profile View Properties there is an option to turn off the End Station Value.

image

Then we get a profile view that doesn’t show the end station value and removes the overlap.

image

Here is a link to a sample drawing.

Sunday, January 29, 2017

Word Paste as Text

Often times I’m copying from a webpage or from another document I want to only include text. In the past I’ve created my own Macro and then created a keyboard shortcut to the macro.

I recently found an easier way to this without the macro. To do this go to the File button and choose Options. From the Word Options dialog box choose Customize Ribbon.

SNAGHTML589e756

Then press the Customize Button. From the Categories column select All Commands and in the Commands column select PasteTextOnly.

SNAGHTML58b63f3

Type your new shortcut in the Press new shortcut key and then press Assign to add it to the list. I’ve used Ctrl + Shift + V as my shortcut, but you can use what your preference. I’d avoid the standard Word shortcuts. Then Press Close and then you can use the keyboard sequence to paste as text.

Monday, January 23, 2017

Upgrading Civil 3D

Sometimes upgrading doesn’t go as planned. I recently tried to use Civil 3D 2017 and I was unable to change the annotation scale. It froze and wouldn’t come back. The reason why is that it was waiting for an upgrade dialog box to say OK. Since it doesn’t show in the UI I was unable to press it. To get everything back to normal I ran the RecoverAll on the drawing. This processed both the drawing and all of the XREFs. All of the drawings are saved as well as having the dialog box pop up where I can press the OK button.

LinkWithin

Blog Widget by LinkWithin

Ad