TheSwamp

CAD Forums => Vertically Challenged => Land Lubber / Geographically Positioned => Topic started by: BlackBox on August 17, 2016, 10:19:42 AM

Title: Civil 3D | Property Sets
Post by: BlackBox on August 17, 2016, 10:19:42 AM
Never really used this before, so could use some guidance, as there doesn't seem to be a good amount of examples in some searching yesterday.

How does one go about adding Coordinates Property Set to a Polyline?

Polylines have a Coordinates Property (Variant type), but I cannot seem to find a way to add this as a Property Set - not even when using VBA code to iterate the Polyline's Coordinates Property to build an array of Doubles.

For that matter, I could not even get the Start Point to display using plineObj.Coordinate(0).

Also, why are Property Sets dependent on VBA; no .NET (within the Formula, that is)?


TIA
Title: Re: Civil 3D | Property Sets
Post by: BlackBox on August 17, 2016, 11:40:37 AM
Here's what I started with:

http://autodesk.typepad.com/bimtoolbox/2016/02/autodesk-2016-aec-showreel-call-for-submissions.html


After adding the ObjectId auto-property (I also tried Handle + HandleToObject Method), I used the following snippets to try and populate Formulas.



Here's a VBA snippet to try and get the Start_Point (which doesn't work):
Code - vb.net: [Select]
  1. Dim RESULT() as Double
  2. On Error Resume Next
  3. Set oApp=GetObject("AutoCAD.Application.20")
  4. Set obj=oApp.ActiveDocument.ObjectIdToObject([ObjectID])
  5. RESULT=obj.Coordinate(0)
  6.  



Here's a VBA snippet to try and get the all Coordinates (which also doesn't work):
Code - vb.net: [Select]
  1. Dim cnt As Integer
  2. Dim i As Integer
  3. Dim j As Integer
  4. Dim iStep As Integer
  5. Dim dblCoords() As Double
  6. Dim RESULT() as Double
  7.  
  8. Set oApp=GetObject("AutoCAD.Application.20")
  9. Set obj=oApp.ActiveDocument.ObjectIdToObject([ObjectID])
  10.  
  11. dblCoords = obj.Coordinates
  12.  
  13. ReDim ptsArr(0 To (UBound(dblCoords) + 1) \ iStep - 1, 0 To iStep - 1) As Double
  14. For i = 0 To (UBound(dblCoords) + 1) \ iStep - 1
  15.   For j = 0 To iStep - 1
  16.            ptsArr(i, j) = dblCoords(cnt)
  17.            Debug.Print ptsArr(i, j)
  18.            cnt = cnt + 1
  19.   Next
  20. Next
  21. RESULT = ptsArr
  22.  
Title: Re: Civil 3D | Property Sets
Post by: Jeff_M on August 17, 2016, 03:55:01 PM
BB, there are only a few supported Formats for output. As far as I have been able to test, you cannot Set this in the Formula, but only in the Format Type. These Types are: Text, Integer, Real, True/False. I have tried this, which I thought would work, to no avail, I can get other properties, but no coordinates.

Code - vb.net: [Select]
  1. RESULT=0
  2. On Error Resume Next
  3. Set oApp=GetObject(, "AutoCAD.Application")
  4. Set obj=oApp.ActiveDocument.ObjectIdToObject([ObjectID])
  5. coord = obj.Coordinate(0)
  6. RESULT=coord(0)
  7.  

I have no clue why they went with quasi-VBA for the formulas. Note that they don't require the Dim xxx As xxxx
Title: Re: Civil 3D | Property Sets
Post by: mjfarrell on August 18, 2016, 09:08:06 AM
why do you want to?

I'm wondering what would be a use of having coordinates attached, or defined to a polyline?
Title: Re: Civil 3D | Property Sets
Post by: BlackBox on August 18, 2016, 04:33:06 PM
BB, there are only a few supported Formats for output. As far as I have been able to test, you cannot Set this in the Formula, but only in the Format Type. These Types are: Text, Integer, Real, True/False. I have tried this, which I thought would work, to no avail, I can get other properties, but no coordinates.

Code - vb.net: [Select]
  1. RESULT=0
  2. On Error Resume Next
  3. Set oApp=GetObject(, "AutoCAD.Application")
  4. Set obj=oApp.ActiveDocument.ObjectIdToObject([ObjectID])
  5. coord = obj.Coordinate(0)
  6. RESULT=coord(0)
  7.  

I have no clue why they went with quasi-VBA for the formulas. Note that they don't require the Dim xxx As xxxx

Thanks, Jeff!




why do you want to?

I'm wondering what would be a use of having coordinates attached, or defined to a polyline?

So they'd show up in Navisworks..? (http://forums.augi.com/showthread.php?166893-COM-help-in-Propoerty-Sets)

One of the forum admins there asked if I could help the OP out with Property Sets... I couldn't figure out how to use the Property Sets for the requested Coordinates, so I posted here hoping that I was overlooking something, and it instead appears to be a limitation of the Architectural integration.



Cheers
Title: Re: Civil 3D | Property Sets
Post by: mjfarrell on August 18, 2016, 05:54:47 PM
what if you you placed a special block @ polyline vertices through points at/along polyline vertices, and grab the data from those blocks?
Title: Re: Civil 3D | Property Sets
Post by: BlackBox on August 19, 2016, 11:08:45 AM
what if you you placed a special block @ polyline vertices through points at/along polyline vertices, and grab the data from those blocks?

How is that manual process less work than simply adding Line and Curve Labels, where you might see the values without selecting anything?
Title: Re: Civil 3D | Property Sets
Post by: mjfarrell on August 19, 2016, 12:17:49 PM
what if you you placed a special block @ polyline vertices through points at/along polyline vertices, and grab the data from those blocks?

How is that manual process less work than simply adding Line and Curve Labels, where you might see the values without selecting anything?

Due to my not quite understanding exactly what or why, I offer a suggestion that may or may not seem suitable for your needs.

Perhaps an illustration and and an explanation  of what you expect to show up outside of civil 3d would prove more effective?

Title: Re: Civil 3D | Property Sets
Post by: BlackBox on August 19, 2016, 04:47:33 PM
what if you you placed a special block @ polyline vertices through points at/along polyline vertices, and grab the data from those blocks?

How is that manual process less work than simply adding Line and Curve Labels, where you might see the values without selecting anything?

Due to my not quite understanding exactly what or why, I offer a suggestion that may or may not seem suitable for your needs.

Perhaps an illustration and and an explanation  of what you expect to show up outside of civil 3d would prove more effective?

No worries, MJF - I was only attempting this to help the user in the linked thread, and to see if I was missing something simple.


Cheers
Title: Re: Civil 3D | Property Sets
Post by: VitalyF on September 18, 2016, 03:59:56 PM
Hi all,
How does one go about adding Coordinates Property Set to a Polyline?

I do not have Civil 3D, so my example for AutoCAD MEP 2017

Code - vb.net: [Select]
  1. RESULT="--"
  2. On Error Resume Next
  3. Set app=GetObject(, "AutoCAD.Application")
  4. Set aec = app.GetInterfaceObject("AecX.AecBaseApplication.7.9")
  5. aec.Init app
  6. Set obj=app.ActiveDocument.ObjectIdToObject([ObjectID])
  7. pt = aec.ActiveDocument.Utility.ConvertToVariantArray(obj.Coordinates)
  8. RESULT = "X= " & pt(0) & " Y=" & pt(1)

Where - AecX.AecBaseApplication.7.9- your AEC Version

(https://s12.postimg.org/muzaqu7pl/AECversion.gif) (https://postimg.org/image/muzaqu7pl/) (https://s10.postimg.org/xe0zh95j9/New_Styles.gif) (https://postimg.org/image/xe0zh95j9/) (https://s22.postimg.org/l3jid9nu5/Pl_Coord.gif) (https://postimg.org/image/l3jid9nu5/)

Best regards!

Title: Re: Civil 3D | Property Sets
Post by: Rod on September 19, 2016, 08:41:55 AM
Saw this http://forums.autodesk.com/t5/autocad-architecture/space-object-elevation-property/td-p/3739563  (http://forums.autodesk.com/t5/autocad-architecture/space-object-elevation-property/td-p/3739563) recently thought it might help. Looks like VitalyF beat me though.
See a lot of potential in using these property sets