Author Topic: civil 3d 2010 and vb.net  (Read 8932 times)

0 Members and 1 Guest are viewing this topic.

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #15 on: August 15, 2009, 12:36:22 AM »
tanks...
Visit my website: http://tbn2.blogspot.com

Spike Wilbury

  • Guest
Re: civil 3d 2010 and vb.net
« Reply #16 on: August 15, 2009, 11:26:28 AM »
Have you downloaded the "Civil3d_DevelopersGuide.PDF" - in there you will find what you are trying to do, it comes with several samples code - in this case using COM or in .NET

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #17 on: August 15, 2009, 12:42:17 PM »
yes, yes it comes with the installation of civil 3d
has only trivial things such as creating pipenetworks or styles

I am developing a program to drainage networks directly in civil 3d, without export or import anything (such as storm hidraflow anything), but some things can not be made because of the api, which is very bad
download:
http://www.inf.ufpr.br/nldm07/progs/C3D_DREN_ESG.zip
screen shot:



I think that Autodesk has no interest to do interesting things because they want to win this ... eg the intersection builder EZY corridor became obsolete (http://www.rsteltman.com/cez_downloads.html)


Visit my website: http://tbn2.blogspot.com

Spike Wilbury

  • Guest
Re: civil 3d 2010 and vb.net
« Reply #18 on: August 15, 2009, 12:52:23 PM »
I am talking about this section - but you been using this API, i simple downloaded to have a look in case were some similarities with the MEP API, that i need to work on:

Quote
Listing and Adding Dynamic Part Properties
Each type of pipe and structure has many unique attributes (such as size, geometry, design, and composition)
that cannot be stored in the standard pipe and structure properties. To give each part appropriate attributes,
pipe and structure objects have sets of dynamic properties. A single property is represented by an
AeccPartDataField object. Data fields are held in collections of type AeccPartDataRecord. You can reach
these collections through the PartDataRecord property of AeccPartSizeFilter, AeccPipe, and AeccStructure
objects. Each data field contains an internal variable name, a text description of the value, a global context
used to identify the field, data type, and the data value itself.
This sample enumerates all the data fields contained in a pipe object “oPipe” and displays information from
each field.
Dim oPartDataField As AeccPartDataField
Debug.Print "All data fields for this pipe:"
Debug.Print "======"
For Each oPartDataField In oPipe.PartDataRecord
Debug.Print "Context name: "; oPartDataField.ContextString
Debug.Print "Description: "; oPartDataField.Description
Debug.Print "Internal name:"; oPartDataField.Name
Debug.Print "Value: "; oPartDataField.Tag
Debug.Print "Type of value:"; oPartDataField.Type
Debug.Print "------"
Next
To create your own dynamic properties, you first create a custom parameter describing the type and name
of the property. You do this by using the pipe network catalog definitions object AeccPipeNetworkCatDef,
which you access through the ambient property AeccPipeSettingsRoot.PipeNetworkCatDef. The
AeccPipeNetworkCatDef object creates new parameters using the
AeccPipeNetworkCatDef.DeclareNewParameter method. DeclareNewParameter takes some strings describing
the parameter data type:
■ a global context (the identification string used to access the parameter type)
■ a global context (the identification string used to access the parameter type)
■ a context description (a description of the parameter)
■ a parameter name (the internally used name of the parameter)
Listing and Adding Dynamic Part Properties | 143
■ a parameter description (the public name of the parameter used by the user interface, such as in the Part
Properties tab of the Pipe and Structure Properties dialog boxes).
Once a parameter has been created, it can be made into a property available for use in parts through the
AeccPipeNetworkCatDef.DeclarePartProperty method.
NOTE The parameter name cannot contain spaces or punctuation characters.
This sample demonstrates declaring a parameter and making a property based on that parameter available
to any pipe objects:
Dim oSettings As AeccPipeSettingsRoot
Dim oPipeNetworkCatDef As AeccPipeNetworkCatDef
Set oSettings = oPipeDocument.Settings
Set oPipeNetworkCatDef = oSettings.PipeNetworkCatDef
oPipeNetworkCatDef.DeclareNewParameter _
"Global Context 01", _
"Context Description", _
aeccDoubleGeneral, _
aeccDouble, _
"Test Parameter", _
"TParam", _
"", _
True, _
False
oPipeNetworkCatDef.DeclarePartProperty
"Global Context 01", aeccDomPipe, 10
You can now choose from among those properties available to the part’s domain and create a data field.
' Make a data field based on the "Global Context 01"
' property and add it to a pipe object "oPipe". Set
' the value of the data field to "6.5".
Dim oPartDataField As AeccPartDataField
Set oPartDataField = oPipe.PartDataRecord.Append
("Global Context 01", 0)
oPartDataField.Tag = 6.5

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #19 on: August 15, 2009, 02:47:40 PM »
in civil 3d 2010 partdatafield "tag" property (in COM API) is read only....
on 2009 and 2008, it is ok

and de example for "PipeNetworkCatDef" in help is wrong....

Visit my website: http://tbn2.blogspot.com

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #20 on: August 15, 2009, 02:49:35 PM »
"de", ops!!!
and the example for "PipeNetworkCatDef" in help is wrong....
Visit my website: http://tbn2.blogspot.com

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #21 on: August 28, 2009, 09:01:13 AM »
Hello again, I'm using the "red gate's. Net reflector" (http://www.red-gate.com/products/reflector/) with the dll "aeccdbmgd.dll" and interesting things appeared:
(Namespace Autodesk.Civil.PipeNetwork.DatabaseServices, partdatafield, value, set_value method)
Code: [Select]
Public Sub set_Value(ByVal newValue As Object)
    Dim type As CatDataType
    If Me.IsReadOnly Then
        Throw New InvalidOperationException("The property is for read only.")
    End If
    Checker.CheckArgNull(newValue)
    If (Me.IsFromList AndAlso Not Me.ValueList.IsValidValue(newValue)) Then
        Throw New ArgumentException("The input value is not in valid value list.")
    End If
    If (Me.IsFromRange AndAlso Not Me.ValueRange.IsValidValue(newValue)) Then
        Throw New ArgumentException("The input value is not in valid value range.")
    End If
    Dim num8 As UInt32 = DirectCast((Me.m_dataField + 8), UInt32*)
    If (num8 <> 0) Then
        type = DirectCast((num8 + 40), CatDataType*)
    Else
        type = DirectCast(0, CatDataType)
    End If
    Select Case type
        Case DirectCast(1, CatDataType)
            Dim num4 As Double = 0
            Try
                num4 = CDbl(newValue)
            Catch exception3 As InvalidCastException
                Throw New ArgumentException("Requires a value of double.")
            End Try
            Dim units As SettingsUnits = <Module>.AeccNetworkUtils.getBuiltinLengthUnits(Me.m_dataField)
            If (units <> DirectCast(0, SettingsUnits)) Then
                Dim flag2 As DwgUnitAndConvertFlag
                Dim servicesPtr As AcDbHostApplicationServices ModOpt(IsConst)* ModOpt(IsConst) ModOpt(IsConst) = <Module>.acdbHostApplicationServices
                <Module>.AeccUnitBase.GetDwgUnitAndConvertFlag(AddressOf flag2, servicesPtr(8), 0)
                Dim num3 As Double = 0
                <Module>.AeccUnitBase.GetConversionFactor(DirectCast(AddressOf flag2, SettingsUnits ModOpt(IsConst)*), DirectCast((AddressOf flag2 + 4), FootToMeterConversion ModOpt(IsConst)*), units, AddressOf num3)
                Dim num9 As Double = DirectCast(AddressOf <Module>.__imp_?gTol@AcGeContext@@2VAcGeTol@@A, Integer*)
                If Not <Module>.AeccGeUtils.fuzzyEqual(num3, 0, num9) Then
                    Dim dataField As AeccDataField* ModOpt(IsConst) ModOpt(IsConst) = Me.m_dataField
                    dataField(&H10) = DirectCast((num3 * num4), AeccDataField* ModOpt(IsConst) ModOpt(IsConst))
                    Dim num2 As UInt32 = dataField(8)
                    If (num2 <> 0) Then
                        num2(40) = 1
                    End If
                End If
            End If
            Exit Select
        Case DirectCast(2, CatDataType)
            Dim num6 As Integer = 0
            Try
                num6 = CInt(newValue)
            Catch exception2 As InvalidCastException
                Throw New ArgumentException("Requires a value of int.")
            End Try
            Dim fieldPtr3 As AeccDataField* ModOpt(IsConst) ModOpt(IsConst) = Me.m_dataField
            fieldPtr3(&H18) = DirectCast(num6, AeccDataField* ModOpt(IsConst) ModOpt(IsConst))
            Dim num5 As UInt32 = fieldPtr3(8)
            If (num5 <> 0) Then
                num5(40) = 2
            End If
            Exit Select
        Case DirectCast(3, CatDataType)
            Dim flag As Boolean = False
            Try
                flag = CBool(newValue)
            Catch exception1 As InvalidCastException
                Throw New ArgumentException("Requires a value of bool.")
            End Try
            Dim fieldPtr4 As AeccDataField* ModOpt(IsConst) ModOpt(IsConst) = Me.m_dataField
            fieldPtr4(&H1C) = DirectCast(flag, AeccDataField* ModOpt(IsConst) ModOpt(IsConst))
            Dim num7 As UInt32 = fieldPtr4(8)
            If (num7 <> 0) Then
                num7(40) = 3
            End If
            Exit Select
        Case DirectCast(4, CatDataType)
            Dim str2 As AecRmCString
            Dim cliString As String = ""
            Try
                cliString = CStr(newValue)
            Catch exception4 As InvalidCastException
                Throw New ArgumentException("The inner type of object^ should be string.")
            End Try
            <Module>.Autodesk.Civil.ConvertCLIString(AddressOf str2, cliString)
            Try
                Dim fieldPtr As AeccDataField* ModOpt(IsConst) ModOpt(IsConst) = Me.m_dataField
                <Module>.ATL.CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >.=((fieldPtr + &H20), DirectCast(AddressOf str2, CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > > ModOpt(IsConst)* ModOpt(IsImplicitlyDereferenced)))
                Dim num As UInt32 = fieldPtr(8)
                If (num <> 0) Then
                    num(40) = 4
                End If
            Fault
                <Module>.___CxxCallUnwindDtor(<Module>.AecRmCString.{dtor}, DirectCast(AddressOf str2, Void*))
            End Try
            <Module>.ATL.CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >.{dtor}(DirectCast(AddressOf str2, CStringT<wchar_t,StrTraitMFC_DLL<wchar_t,ATL::ChTraitsCRT<wchar_t> > >* ModOpt(IsConst) ModOpt(IsConst)))
            Exit Select
    End Select
End Sub


note that if the value is of type double, it is modified only if the units of measurement do not match ... very strange ...

While well as for other types of data, is not working ...

If anyone here understand what is happening and to resolve the problem, I am willing to pay for the solution
Visit my website: http://tbn2.blogspot.com

neyton

  • Newt
  • Posts: 67
Re: civil 3d 2010 and vb.net
« Reply #22 on: September 11, 2009, 11:17:13 AM »
Visit my website: http://tbn2.blogspot.com

StefanDidak

  • Guest
Re: civil 3d 2010 and vb.net
« Reply #23 on: November 04, 2009, 10:48:29 AM »
and not really the sort of thing I've grown to expect from a true Framework.
Quoted for 110% total agreement.

It wouldn't be so quirky and like developing in the middle of an uncharted minefield if things were also implemented following standards or at the very least some resemblance of consistency. Like, oh, collections that implement IEnumerable but instead of throwing a count as 0 instead just throw *exceptions* all over the place.   :roll: