.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

transfert project 2010 to 2014 - Command synchro not working

2 REPLIES 2
Reply
Message 1 of 3
AubelecBE
603 Views, 2 Replies

transfert project 2010 to 2014 - Command synchro not working

hello, i have a vb.net prog :

1 - create a bloc with 2 attribut

2 - insert the bloc

3 - insert field in the attribut

4 - regen for regen the attribut with the good text (name of dwg and name of one xref)

5 - check the dim of the bloc

6 - add in the blockDef, a polyline

7 - end

 

in acad 2010 it is work fine but not in 2014. the etap 4 not working

 

here the code in the sub (etap 4)

 GestionAUTOCAD.LigneCommandeImmediate("_regen")

 

and here the function code in my gestionAutocad.vb :

  '***********************************************************************
    '**  Fonction Lancement d'une commande Synchrone sur la ligne         **
    '**   de commande d'Autocad                                           **
    '***********************************************************************
    '** ENTREE (exemple)                                                  **
    '**   Tracé une ligne :
    '**     CommandeSync("_.line", New Point3d(10.0, 20.0, 0.0), New Point3d(80.0, 50.0, 0.0), "")
    '**   Freeze du calque 0                                              
    '**     CommandeSync("_.vplayer", "_freeze", "0", "_select", "\", "", "")
    '**
    '** Note:
    '**   - an empty string ("") means a validation (Enter)
    '**   - an anti-slash ("\" with VB or "\\" with C#) means a pause for user input.
    '**
    '**   - Texte : Le texte à afficher                                   **
    '***********************************************************************
    '** with A2013, replace "acad.exe" with "accore.dll" in the DllImport attribute arguments.
    '*******************************************************************************************
#If _AcadVer_ = 2010 Then
    <System.Security.SuppressUnmanagedCodeSecurity()> _
        <System.Runtime.InteropServices.DllImport("acad.exe", _
              EntryPoint:="acedCmd", _
              CharSet:=System.Runtime.InteropServices.CharSet.Unicode, _
              CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)> _
    Private Function acedCmd(ByVal resbuf As IntPtr) As Integer
    End Function
#ElseIf _AcadVer_ = 2014 Then
    <System.Security.SuppressUnmanagedCodeSecurity()> _
        <System.Runtime.InteropServices.DllImport("accore.dll", _
              EntryPoint:="acedCmd", _
              CharSet:=System.Runtime.InteropServices.CharSet.Unicode, _
              CallingConvention:=System.Runtime.InteropServices.CallingConvention.Cdecl)> _
    Private Function acedCmd(ByVal resbuf As IntPtr) As Integer
    End Function

#End If


    '''<summary>
    ''' Call an AutoCAD command (runs synchronously).
    ''' </summary>
    ''' <param name="args">The command name followed by command inputs.</param>
    ''' 
    Public Sub LigneCommandeImmediate(ByVal ParamArray args As Object())
        Dim resbuf As New ResultBuffer()
        For Each obj As Object In args
            Select Case obj.GetType().Name
                Case "String"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Text), obj))
                    Exit Select
                Case "Int16"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Int16), obj))
                    Exit Select
                Case "Int32"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Int32), obj))
                    Exit Select
                Case "Double"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.[Double]), obj))
                    Exit Select
                Case "Point2d"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Point2d), obj))
                    Exit Select
                Case "Point3d"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.Point3d), obj))
                    Exit Select
                Case "ObjectId"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), obj))
                    Exit Select
                Case "ObjectId[]"
                    For Each id As ObjectId In DirectCast(obj, ObjectId())
                        resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), id))
                    Next
                    Exit Select
                Case "ObjectIdCollection"
                    For Each id As ObjectId In DirectCast(obj, ObjectIdCollection)
                        resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.ObjectId), id))
                    Next
                    Exit Select
                Case "SelectionSetDelayMarshalled", "SelectionSetFullyMarshalled"
                    resbuf.Add(New TypedValue(CInt(Autodesk.AutoCAD.Runtime.LispDataType.SelectionSet), obj))
                    Exit Select
                Case Else
                    Throw New InvalidOperationException("Unsupported type in Command() method")
            End Select
        Next

        acedCmd(resbuf.UnmanagedObject)
    End Sub

 

why it is not working in acad 2014 ?

so i can replace the function with a new part issu from the new version of acad 2014 ?

 

thanks

 

 

 

 

 

 

2 REPLIES 2
Message 2 of 3
Hallex
in reply to: AubelecBE

Just on the quick glance: is this line right:
Case "ObjectId[]" in vb.net?
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 3
AubelecBE
in reply to: Hallex

yes. but i send a string so it is not the bug here.

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost