Get Vertical Exaggeration of a profile view

Hello,

this is a little follow up to a question I had earlier.
I’m trying to get the value for the vertical exaggeration of my profile view.

For whatever reason (this was already badly implemented in Civil3d as one wasn’t able to retrieve the vertical exaggeration of a profile view via expressions) and while seemingly everything else is covered, this value doesn’t show up in the ObjectExtensions.GetParameters-Node:

HasSaveVersionOverride
PlotStyleNameId
IsEditable
Classifications
Layer
ElevationMin
AutomaticallyBoundSpaces
IsReferenceStale
Transparency
ProfileType
IsObjectIdsInFlux
Closed
Visible
Plinegen
NeedsPromoting
IsUsed
Material
PlotStyleName
ShowToolTip
Color
IsReallyClosing
LinetypeScale
PaperOrientation
ForceAnnoAllVisible
Length
ColorIndex
Overrides
UseDesignCheckSet
IsReferenceObject
IsCancelling
IsNewObject
ReceiveShadows
IsEraseStatusToggled
IsModifiedXData
HasFields
IsUndoing
SwappingReferences
IsNotifying
IsReferenceSubObject
AcadObject
EndingStation
IsNotifyEnabled
IsModified
UpdateMode
UseDesignCriteriaFile
IsReadEnabled
IsErased
Database
CastShadows
IsWriteEnabled
DesignSpeedBased
IsDisposed
PVIs
ElevationMax
UndoFiler
Hyperlinks
BlockName
Entities
DrawableType
IsModifiedGraphics
ProjectState
Linetype
Handle
EntityColor
IsHighlighting
Offset
Annotative
StartingStation
LineWeight
IsAProxy
ClassID
IsTransactionResident
AutoDelete
IsReferenceValid
MaterialMapper

Let’s say I want to insert some blocks in my profile view and set their Y-Scale to the vertical exaggeration of my profile view. How would I do this?

To clarify with an example: let’s take a fictional profile view with a vertical extent of 15m, a vertical exaggeration of 10 and one design profile:
I can get the absolute height of my profile view with a bounding box so it’ll be 150m in this example. Unfortunately, I’m not sure how this information came to be - it could just as well be a profile view with a vertical extent of 150m and a vertical exaggeration of 1.

I can also retrieve the ElevationMin and ElevationMax of my profile view. However, if my profile view is set to automatic in the Elevation Range Tab it won’t retrieve the real (visible) min- and max elevations but the ones from my design profile. In this example it could be something like ElevationMin = 1.367 and ElevationMax = 5.393. So I’m not sure how I could work with those values.

Any help is much appreciated!

tl;dr:
I want to get the vertical exaggeration of a Civil3d-ProfileView as a numeric value.

The exaggeration is in the style of the profile view, not a property of the profile view itself.

Right, that’s true. But does that also mean that there’s no way to get this information?
There’s no way to “inspect” styles for anything but their name, right?

I can’t find OOTB nodes nor in the Civil3DToolkit.

Also, styles contains hundreds of properties, grouped and listed, so it is not really easy to get a single property with a GetParameter node.

In C# you can use this:

        public static double GetProfileViewExaggeration(string profileViewStyleName)
        {
            double returnValue = 1.0;

            try
            {
                acDbServ.Database db = acAppServ.Application.DocumentManager.MdiActiveDocument.Database;
                using (acDbServ.Transaction trans = db.TransactionManager.StartTransaction())
                {
                    Autodesk.Civil.ApplicationServices.CivilDocument civilDoc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument;
                    ProfileViewStyle pvs = trans.GetObject(civilDoc.Styles.ProfileViewStyles[profileViewStyleName], acDbServ.OpenMode.ForRead) as ProfileViewStyle;
                    returnValue = pvs.GraphStyle.VerticalExaggeration;
                    trans.Commit();
                }
            }
            catch (System.Exception ex) { }

            return returnValue;
        }

You can convert that into Python, it should not be hard to do so.

3 Likes

Puh, that’s way above my current level - I was happy to be able to connect some nodes. :slight_smile:

I’ll do some research and try it out - I’ll post my solution if I’m successful!
Thanks for your help! :+1:

@pumpaij here you go.

import clr

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

def get_profile_view_exaggeration(styleName):

	adoc = Application.DocumentManager.MdiActiveDocument
	cdoc = CivilApplication.ActiveDocument
	
	if not styleName:
		return
	
	with adoc.LockDocument():
		with adoc.Database as db:
			with db.TransactionManager.StartTransaction() as t:
				pvStyle = t.GetObject(cdoc.Styles.ProfileViewStyles[styleName], OpenMode.ForRead)
				result = pvStyle.GraphStyle.VerticalExaggeration
				t.Commit()
				pass
	return result

OUT = get_profile_view_exaggeration(IN[0])
4 Likes

Great stuff, works like a charm!
It’s also quiet helpful to see the C#-Python-conversion in a functioning example!

Thanks everyone!

@pumpaij you could also check out Camber, my new package for Civil 3D. There are some nodes to work with Profile View Styles.

2 Likes

Truly great stuff! I can’t wait to dig deeper into this package.
Thanks a lot for creating it and making it available to all.