Saturday 30 September 2017

Civil 3D limited automated annotation. Alignment name can not be mentioned for an axis in a Section View.

I tried to find a fully automated way to annotate alignment axies in section views. Bummer !

I did an internet search. Same problem for other users.

Profile Grade Line Marker Point is capable of using blocks containing whatever info. But all this must be made by hand, one by one !!!

So i used VB.net to create a custom app to solve this problem.

Reads the Civil database and gets all the axies (with or without profile).
Exposes them to the user to select which of them to work with using CheckedListBox.
Creates blocks with the Alignment names.
Assigns them to new MarkerPoint Styles.
Select PGL to create using those new MarkerPointStyles.

I could also create plain autocad points and text for each PGL but these objects do not belong to the section view and that is a disadvantage.

App soon to be completed and available for downloading for Civil 3D 2017.

Autocad custom apps : DBtext rotation angle

Well, always the same problem when it is time to code for angles.
Where is the zero, what direction, what units...

This is for the Autodesk.Autocad.Database.DBtext (single line text)
Here is the code for this case

        Dim AngleIs As Double
        AngleIs = CDbl(Me.tbAngle.Text) 'angle got in Gradians from a text box
        AngleIs -= 100 'Gradians i said
        AngleIs = -AngleIs
        AngleIs = AngleIs * math.PI/200 'Gradians i said

Units : radians
Direction : CounterClockWise
Zero : Positive X axis

Autocad custom apps : Block entities assignment cases

A block can add Entities using two methods.

block.AppendEntity(entity)
Entities created and added immediately in the block, not the BlockTable

block.AssumeOwnerShipOf(CollectionOfObjectIDs)
Entities are already created and exist in the BlockTable. If not copied then after commiting transaction they dissapear from the Model/Paper Space blocks and they "live" only in the block !

I had a hard time trying to configure how to do the second case. Adding existing entities to a block. All examples i found were for the first case.

Tuesday 26 September 2017

SAC : strings, enums and math

In Subassembly Composer is possible to refer to the Math library of Microsoft Visual Basic.
But it is not possible to use simple functions such as CSTR or CDBL. No further library can have a reference.

Also Enum.value results to a string value. It can be used in Switch. But it can not be used as a string in a point code ! To do this you must DefineVariable (string) and finally assign the variable to the point Code !

Codes are capable of direct strings or direct string variables.