Thursday 16 March 2017

Civil 3D 2017 custom programme, Section views Elevation Minimum set on the fly

Elevation minimum of selected section views can be changed on the fly with this custom programme-plug in, for Civil 3D 2017.

First download the plug in...
https://www.dropbox.com/s/bhpgymcp4herkdq/C3D2017_SectionViewElevMin.dll?dl=0
and save it anywhere you want

Then when in autocad at command line enter NETLOAD and select C3D2017_SectionViewElevMin.dll

At the command line enter setHRZ
enter the new horizon (minimum elevation)
select the desired section views

Finally right click on a section view line and select Update Section View Layout

 

AutoCAD object properties exposed by Active X as ReadOnly

Visual LISP is great tool considering portability and debugging.
It uses active x to get objects.
There are properties exposed by active x that are exposed as Read Only while in NET they are exposed as Read Write !
For example in Civil 3D, section views, elevation min/max, offset left/right are ReadOnly when getting through active x. So i had to turn to NET to change their values.

So a good practice before starting developing using VBA or Visual Lisp is to check whether properties are exposed by active x and if so if they are writeable.

A on the fly method to get the available properties and their RW availability is through command line entering the following command.

(vlax-dump-object (vlax-ename->vla-object (car (entsel))) T)

The T at the end asks for the available methods and can be omitted.
The (RO) next to property indicates that are Read Only.

Following is a copy-paste from the results in command window (F2)...

; IAeccSectionView: interface IAeccSectionView
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000007499ce10>
;   BandSet (RO) = #<VLA-OBJECT IAeccSectionViewBandSet 000000007499e5b8>
;   Description = ""
;   DisplayName (RO) = "0+880 (45)"
;   Document (RO) = #<VLA-OBJECT IAeccDocument 0000000074996570>
;   ElevationMax (RO) = 35.0
;   ElevationMin (RO) = 28.0
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "8C4D"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000075afed68>
;   Layer = "Sections & Section Views Dev"
;   LengthLeft (RO) = -11.2552
;   LengthRight (RO) = 31.6704
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "0+880 (45)"
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AeccDbGraphCrossSection"
;   OffsetLeft (RO) = -11.2552
;   OffsetRight (RO) = 31.6704
;   Overrides (RO) = #<VLA-OBJECT IAeccSectionOverrides 000000007499aec8>
;   OwnerID (RO) = 43
;   Parent (RO) = #<VLA-OBJECT IAeccSampleLine 000000004bd402b0>
;   PlotStyleName = "ByLayer"
;   ShowToolTip = -1
;   Style = #<VLA-OBJECT IAeccSectionViewStyle 000000004fc38ed0>
;   StyleName (RO) = "TKV - CS name and station"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000075afea00>
;   Type (RO) = 4
;   VerticalScale = 1.0
;   Visible = -1
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   FindStationOffsetAndElevationAtXY (6)
;   FindXYAtStationOffsetAndElevation (6)
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   IsReferenceObject ()
;   IsReferenceStale ()
;   IsReferenceSubObject ()
;   IsReferenceValid ()
;   IsValid ()
;   Layout ()
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()
T