Ad

Thursday, August 08, 2019

Ghost Viewport

Sometimes a ghost viewport will show up after using the Corridor Section Command. I haven't found a way to remove the viewport via the User Interface. Here is some c#.NET Code that appears to get rid of the bad viewport.


public class FixViewports
{
    [CommandMethod("FixViewports")]
    public static void FixViewportsCommand()
    {
        var doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
        var db = doc.Database;
        var ed = doc.Editor;

        try
        {
            if (!db.TileMode)
            {
                ed.WriteMessage("Must be in Model Space");
                return;
            }

            using (var tr = db.TransactionManager.StartTransaction())
            {
                var vpTable = db.ViewportTableId.GetObject(OpenMode.ForWrite) as ViewportTable;

                foreach (var vpObjId in vpTable)
                {
                    var vpTblRec = vpObjId.GetObject(OpenMode.ForRead) as ViewportTableRecord;

                    ed.WriteMessage("ViewportName: " + vpTblRec.Name);

                    if (vpTblRec.Name.Equals("*Active", StringComparison.OrdinalIgnoreCase) || 
                        vpTblRec.Name.Equals("Civil 3D Section Editor Viewport Configuration Snapshot", StringComparison.OrdinalIgnoreCase))
                    {
                        ed.WriteMessage("Deleting Viewport: " + vpTblRec.Name);
                        vpTblRec.UpgradeOpen();
                        vpTblRec.Erase();
                    }
                }

                using (var vpRightTblRec = new ViewportTableRecord() { Name = "*Active", LowerLeftCorner = new Point2d(0, 0), UpperRightCorner = new Point2d(0.5, 1) })
                {
                    vpTable.Add(vpRightTblRec);
                    tr.AddNewlyCreatedDBObject(vpRightTblRec, true);
                }

                using (var vpLeftTblRec = new ViewportTableRecord() { Name = "*Active", LowerLeftCorner = new Point2d(0.5, 0), UpperRightCorner = new Point2d(1, 1) })
                {
                    vpTable.Add(vpLeftTblRec);
                    tr.AddNewlyCreatedDBObject(vpLeftTblRec, true);
                }

                vpTable.DowngradeOpen();

                ed.UpdateTiledViewportsFromDatabase();

                tr.Commit();
            }
        }
        catch (System.Exception ex)
        {
            ed.WriteErrorMessage("Error: " + ex.Message);
        }
    }
}

Friday, June 07, 2019

Enterprise CUIx - Express Tools Keeps Loading


Way back in Autodesk University 2009 Robert Bell had a class on using an Enterprise cuix.

https://forums.augi.com/showthread.php?158968-AU222-1-A-Working-Enterprise-CUI-in-Front-of-Your-Eyes

Sometime around AutoCAD 2013 Autodesk decided that the Express Tab wasn't being loaded, so on first profile creation AutoCAD would add the Express tab to the user's cuix. Unfortunately, the Enterprise may contain the Workspace and if the Express tab was shown the Express cui. Using the Enterprise CUI then caused the Express Tab to be added to the user cuix.

To fix this issue you can add the key AutoCAD uses to see if the Express Tab has already been loaded to the default profile in the HKEY_LOCAL_MACHINE. The Registry Key is this one (the user is shown):

[HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R23.1\ACAD-3000:409\Profiles\Design\General]
"ACET-ACETMAIN-MENULOADED"="1"

Now the Express Tab won't be loaded on the first run of a user's profile.

Tuesday, May 28, 2019

AU Class Submittal: Transportation Intro Class in 90 Minutes

A real class or cover for a why Civil 3D isn't BIM class?

Class Title: Transportation Intro Class in 90 Minutes

Class description:
A fast-paced class intended to take a three-day transportation-focused Introductory Civil 3D Class and squeeze it into 90 minutes. At the end of the class an off-ramp will be modeled and cross sections will be ready to be printed. The class will cover a wide range of Civil 3D viewing, and TIN Surface operations. Roadway design will include alignments, profiles, corridors, sharing data, superelevation, and report generation. 

Class format
Instructional Demo

Length: 90 Minutes

Learning Objective 1: Create an On-Ramp including an alignment, profile, and corridor.

Learning Objective 2: Create a widening or pullout for a maintenance area.

Learning Objective 3: How to apply and modify a Superelevation for an On-Ramp.

Learning Objective 4: Create and use Surface Data.

Briefly summarize your class: A transportation class focused class on how to do a basic Freeway On-Ramp using Civil 3D.

Sunday, May 19, 2019

Export Civil 3D Table to CSV

A long desired feature is the ability to convert Civil 3D tables to a useable format. Whether it be an AutoCAD Table or Export to Excel. By long desired I mean over a decade.

I guess we don't matter, as customers, if it takes a decade to do something I'm able to do in an afternoon while I procrastinate. I'm even doing it the hard way. It would be way easier if Autodesk provided an API method of grabbing the Civil 3D Table's contents (along with Civil 3D Labels) or include the command in Civil 3D so I wouldn't have to write this stupid blog post.

This post covers how to export a Civil 3D table to a CSV file. The steps are similar if you want to export to Excel. The Title row would need to be taken care of. This could be done by looking at the Table Style and seeing if it has a Title Row included. That's for another possible blog post.

The first step is to have the user get the table. I've written the table for an Alignment Tag Label Table, you'll have to add the other types you want to run the code on.


Then we need to explode the table into its individual components. The FullExplode method handles that task. After exploding, the objects are sorted into vertical lines, horizontal lines, and MTexts.


Then the range of vertical and horizontal lines are gotten, these will be used to identify where the rows and columns are located. The Distinct() is used because the exploded tables end up having lines for each row and column.


Next the row data is processed by columns and written to the csv file.


After the data is collected the file is opened and the objects collected disposed of.

Add caption
















This code is more of a proof of concept on how to export to csv. More work would be needed to make it perfect. If the table is split, then each table section would need to be exported separately.

The code may be found here: https://1drv.ms/u/s!AqAPKXdBD3fOnE6C8F-hhCnFi3nH

Wednesday, May 15, 2019

AU Idea: Theater Talk

Simply a note for future reference. Feel free to ignore or vote when AU 2019 Las Vegas proposals are voted on.

Title for Your Theater Talk: Reimagining Civil 3D Corridor Targeting

Describe the focus of your Theater Talk:

Corridor Targets assignment in Civil 3D is laborious, repetitive, and not intelligent. What if the process could be elevated from a simple one at a time process, to one that allows for multiple targets to be applied simultaneously? This talk talks about the development of such a tool. It starts with the initial brainstorming ideas and goes through the development process. I'll talk about what ideas were added and/or dropped from the tool. The talk will explore how filtering of drawing data available for targeting, sorting all of the applied assemblies into groups and subgroups of subassemblies, and pattern matching was used to reduce the time it takes to assign corridor targeting by more than 50%.

Theme of Presentation:
Work Reimagined - What We Do, How We Do

Class Focus:
Thought leadership and innovation

Link to a sample presentation you have made:
https://twitter.com/cadpanacea/status/1127999871833653248


LinkWithin

Blog Widget by LinkWithin

Ad