Property Sets and invert elevation

Property Sets and invert elevation

hericson
Advocate Advocate
11,851 Views
27 Replies
Message 1 of 28

Property Sets and invert elevation

hericson
Advocate
Advocate

I'm trying to use Property Sets for my structures and pipes. Now I want to add invert elevation in the start and end points but can't understand how to do it. I'm using this code for other properties:

 

RESULT="—"
On Error Resume Next
Set oApp=GetObject(, "AutoCAD.Application")
Set oCivilApp=oApp.GetInterfaceObject("AeccXUiLand.AeccApplication.11.0")
Set obj=oCivilApp.ActiveDocument.HandleToObject("[Handle]")
RESULT=obj.Name

 

I found this post about invert elevations but it doesn't make sense to me how to do it: Help With Property Sets--Invert of Pipes

Anyone who can help me bring some light on this?

0 Likes
Accepted solutions (2)
11,852 Views
27 Replies
Replies (27)
Message 2 of 28

ccedilloYSFN7
Explorer
Explorer

Any luck? I'm having the same issue..

0 Likes
Message 3 of 28

samir_rezk
Advisor
Advisor

Hi @ccedilloYSFN7 

please elaborate on what it isy you’re trying to create a propert set for. Is it the structure connected pipes or the pipes them selves?! Also what is version are you using, the code is dependent on the version of civil 3d.

thsnks


Samir Rezk
Technical Support Specialist

Message 4 of 28

ccedilloYSFN7
Explorer
Explorer

Hi @samir_rezk,

 

I am trying to create a property set that would allow me to view the Start and End Invert Elevations a Pipe (Pipes themselves) in Civil 3D 2018. I have been using the VB Script code (shown below) to bring in other Geometry but cant figure out the code for Invert Elevations.

 

RESULT="--"

On Error Resume Next

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

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

Set obj=oCivilApp.ActiveDocument.HandleToObject("[Handle]")

RESULT=obj.StartInvertElevation

 

 

0 Likes
Message 5 of 28

samir_rezk
Advisor
Advisor
Accepted solution

Hi,

I want to explain a little bit about how to write the VBA code that's required to read Civil 3D object properties because there is a couple of things that you need to be aware of depending on what you are trying to accomplish:

example code is:

 

RESULT="—"

(common VBA technique to publish the outcome of the code at the beginning)

 

On Error Resume Next

(this ensures that if the code fails the program does not crash)

 

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

(Civil 3D is built on top AutoCAD so we must get access to the acad application first)

 

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

(this is where it starts getting tricky because there is 4 major civil application that can be listed here, then you must specify the version depending on what Civil 3D year version you are running)

The 4 Civil apps are 

  • AeccxUiLand (all other Civil 3D Objects)
  • AeccUiPipe (for Pipe Networks)
  • AeccxUiRoadway (for Corridors)
  • AeccxUiSurvey (survey Figures)

 

Capture.JPG

 

right click and go to properties/details tab to identify the version no. it is different per the Civil 3D year version. (Civil 3D 2019 is v. 13.0)

Capture2.JPG

Set obj=oCivilApp.ActiveDocument.HandleToObject("[Handle]")

(you must have the Handle field included in your property set! this is going to be an automatic field that must be added prior to creating this formula field, it's necessary because it creates the link between the object designation in AutoCAD and  it's Civil 3d properties)

 

RESULT=obj.Name

(finally we are going to reveal the property of the Civil 3d object that we want to read)

the best and easiest way to get a complete picture of what properties you can read and what to write on this line is to run the DumpObject.LSP provided at http://www.lee-mac.com/dumpobject.htmlObject.

this lisp routine will result is an example listing as the following that I generated by selecting a pipe object, as you can see you now have all the Civil 3D  Property Names applicable to a certain object and you can now use the property name as a Result in your VBA Code (note that the properties are different for each object so properties of a structure are different than those for a pipe)

 

Select object: ; IAeccPipe: Pipe interface
; Property values:
; Alignment = nil
; Application (RO) = #<VLA-OBJECT IAeccApplication 000001c5c35d8080>
; ClosestPointTo (RO) = ...Indexed contents not shown...
; Connectors (RO) = #<VLA-OBJECT IAeccConnectors 000001c5c35d8da0>
; Description = "12 inch Concrete Pipe"
; DisplayName (RO) = "Pipe - (1)"
; Document (RO) = #<VLA-OBJECT IAeccDocument 000001c5c35d8590>
; EGLDown = 0.0
; EGLUp = 0.0
; EndPoint (RO) = #<VLA-OBJECT 000001c5c35d87a0>
; EndStructure (RO) = #<VLA-OBJECT IAeccStructure 000001c5c33b2990>
; EntityTransparency = "ByLayer"
; FlowDirection (RO) = 1
; FlowDirectionMethod = 1
; Handle (RO) = "86C8"
; HasExtensionDictionary (RO) = 0
; HGLDown = 0.0
; HGLUp = 0.0
; HoldOnResize = 0
; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000001c5c3bc5548>
; InnerDiameterOrWidth (RO) = 1.0
; InnerHeight (RO) = 1.0
; IsMaxCoverViolated (RO) = ...Indexed contents not shown...
; IsMinCoverViolated (RO) = ...Indexed contents not shown...
; Labels (RO) = #<VLA-OBJECT IAeccPipeLabels 000001c5c3c25eb0>
; Layer = "C-STRM-PIPE"
; Length2D (RO) = 115.963
; Length3D (RO) = 115.969
; Linetype = "ByLayer"
; LinetypeScale = 1.0
; Lineweight = -1
; Material = "ByLayer"
; MaximumCover (RO) = 0.0
; MinimumCover (RO) = 0.0
; Name = "Pipe - (1)"
; ObjectID (RO) = 42
; ObjectName (RO) = "AeccDbPipe"
; OuterDiameterOrWidth (RO) = 1.33333
; OuterHeight (RO) = 1.33333
; OwnerID (RO) = 43
; ParamsBool (RO) = #<VLA-OBJECT 000001c5c35d9f40>
; ParamsDouble (RO) = #<VLA-OBJECT 000001c5c35da420>
; ParamsLong (RO) = #<VLA-OBJECT 000001c5c35da480>
; ParamsString (RO) = #<VLA-OBJECT 000001c5c35d9fa0>
; PartDataRecord = #<VLA-OBJECT IAeccPartDataRecord 000001c5c35da840>
; PartFamily (RO) = #<VLA-OBJECT IAeccPartFamily 000001c5beb87e60>
; PartSizeName (RO) = "12 inch Concrete Pipe"
; PartType (RO) = 10
; PlotStyleName = "ByLayer"
; PointAtParam (RO) = ...Indexed contents not shown...
; Position (RO) = #<VLA-OBJECT IAeccPoint3d 000001c5c35da930>
; ProfileNetworkParts (RO) = #<VLA-OBJECT IAeccGraphProfileNetworkParts 000001c5c3c25910>
; Radius (RO) = 0.0
; ShowToolTip = -1
; Slope (RO) = 0.01
; StartPoint (RO) = #<VLA-OBJECT 000001c5c35db350>
; StartStructure (RO) = #<VLA-OBJECT IAeccStructure 000001c5c33b6190>
; STMPipeMetadata = unsupported result type: 65
; Style = #<VLA-OBJECT IAeccPipeStyle 000001c5beb894e0>
; SubEntityType (RO) = 0
; Surface = nil
; SweptShape (RO) = 2
; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000001c5c3bc61a0>
; Visible = -1
; WallThickness (RO) = 0.166667

 

Hope this helps, 


Samir Rezk
Technical Support Specialist

Message 6 of 28

Buzz0m
Collaborator
Collaborator

This post is pure gold! Thank you @samir_rezk !!

0 Likes
Message 7 of 28

Anonymous
Not applicable

Hi 

 

RESULT="--"
On Error Resume Next
Set oApp=GetObject(, "AutoCAD.Application")
Set oCivilApp=oApp.GetInterfaceObject("AeccXUiPipe.AeccApplication.13.0")
Set obj=oCivilApp.ActiveDocument.HandleToObject("[Handle]")
RESULT=obj.aec_pipe_end_invert_elevation

 

Dear colleague's what would be the correct obj.result code to get pip invert elevation?

 

Thank you in advance

 

0 Likes
Message 8 of 28

samir_rezk
Advisor
Advisor

Hi @Anonymous 

Invert Elevation is not an available property that can be added to a property set. the DumpObject Lisp does not show an applicable property for inverts. I also double check the API documentation at the link below, but unfortunately it is not available!

http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXPipeLib__IAeccPipe.htm

Sorry,


Samir Rezk
Technical Support Specialist

Message 9 of 28

samir_rezk
Advisor
Advisor
Accepted solution

Hi @Anonymous 

 

I stand corrected! It has been bugging me all day today, on how to calculate the Invert Elevations for a Property Set! considering that I noticed there is a StartPoint and EndPoint API Properties available, granted these are points for the center of the Pipe not the Inverts.

 

Here is the Code that can calculate Invert Elevations based on (start point elev minus 1/2 the pipe size) my application versions are for Civil 3D 2020, so make sure to revise as necessary for your version!

 

RESULT = "-"
On Error Resume Next
Set oApp = GetObject(, "AutoCAD.Application")
Set oCivilApp = oApp.GetInterfaceObject("AeccXUiPipe.AeccPipeApplication.13.2")

Set Aec = oApp.GetInterfaceObject("AecX.AecBaseApplication.8.2")
aec.Init oApp

Set obj = oCivilApp.ActiveDocument.HandletoObject("[Handle]")

spos = aec.ActiveDocument.Utility.ConvertToVariantArray(obj.PointAtParam(0))

RESULT =(spos(2)-obj.InnerDiameterOrWidth/2)

 

I can't say that I totally comprehend the whole code but some of it makes sense!

captrue.png

 

Need to give credit to an earlier post for the original VBA Code found at:

https://forums.autodesk.com/t5/civil-3d-customization/get-point3d-values-in-property-set/m-p/7963513...

 

Sample drawing containing property set definition attached.

 

reminder to use AECPSDAUTOATTACH system variable to auto attach Property sets to objects.

 

hope this helps,


Samir Rezk
Technical Support Specialist

Message 10 of 28

Anonymous
Not applicable

Thx you verry much! You are a real wizard! Have an awesome day 😁

Message 11 of 28

hericson
Advocate
Advocate

Excellent! Finally a solution! Thanks!

Message 12 of 28

ishaq03
Advocate
Advocate

 

Samir

 my application versions are for are for Civil 3D 2020 I am using the same code for 2022 version can you provide me this code in 20222 for invert elevation start & end along with pipe length. This content I need urgently required for my  project please do the favor for me rapidly, waiting for your feedback.

0 Likes
Message 13 of 28

samir.rezk
Autodesk Support
Autodesk Support

@ishaq03 

Use the same code from message 9! just replace the product versions once you review the Civil 3D ABOUT command:

  • Use 13.4 (Civil 3D 2022) instead of 13.2 (2020) 
  • and 8.4 (AutoCAD Arch. 2022) instead of 8.2 (2020)

2021-09-14_07-41-59.png

 

Hope this helps,




Samir Rezk
Technical Support Specialist

Message 14 of 28

ishaq03
Advocate
Advocate

After adding the code as per your advice I am unable to get get invert level check attached pic for your references.

0 Likes
Message 15 of 28

samir.rezk
Autodesk Support
Autodesk Support

@ishaq03 

Make sure to add an Automatic Property for the object Handle first, then in the invert code delete the [Handle] text and double click to add it again (the text should have a grey background), this make the connection between the code and the Civil 3D object to interrogate. Review message 5 for an explanation!

 




Samir Rezk
Technical Support Specialist

Message 16 of 28

ishaq03
Advocate
Advocate
Thanks for your sample video it's help me to get Start Invert elevation. But please explain me how to get end invert elevation.
0 Likes
Message 17 of 28

samir.rezk
Autodesk Support
Autodesk Support

Hi @ishaq03 

Review the screen capture in message 9 for the End Invert. There is only one parameter to change for the end of pipe information! I noted it on the screen capture!




Samir Rezk
Technical Support Specialist

Message 18 of 28

ishaq03
Advocate
Advocate
I Know I am giving trouble to you, but please can you Provide me any code for Pipe length to add in custom properties.
0 Likes
Message 19 of 28

ishaq03
Advocate
Advocate
Thanks samir, It's awesome Ones we will add handle object the information we can extract from Either pipe or Structure element. Thanks again
0 Likes
Message 20 of 28

jaanYPY4L
Advocate
Advocate

Can someone confirm this is not working in Civil 2022, latest update? Or is something wrong with my Civil... Its the same .dwg you uploaded.

jaanYPY4L_0-1640089119747.png

jaanYPY4L_1-1640089183184.png

 

 

0 Likes