• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    *James Maeding

    Can GRDRAW be done with VB.net?

    258 Views, 19 Replies
    09-12-2005 10:51 AM
    I do tons of grdraw type stuff with lisp.
    I am looking at if the .net API will allow me to draw temprary vectors like grdraw did.

    I am guessing this has been answered before but did not find it in this group.

    In addition, teach me to fish.
    How should I have investigated this on my own?
    I am a pretty good VB6 writer, and learning VB.net and how the frameworks "work" for any language.

    But this would be a great case study I could learn from.

    Shoul I be looking at some help file showing an object model for the .net acad API?
    I downloaded the objectarx sdk help files, not sure if that applies to using VB.net though.

    or should I have visual studio.net installed and reference the right dll's (or frameworks...) and look in the object
    browser there?

    how do real programmers walk through the .net API for acad to see whats in it?
    feel free to redirect me to other threads, this has to have been talked about before...

    Thanks in advance.

    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    Distinguished Contributor
    Posts: 1,691
    Registered: ‎12-15-2003

    Re: Can GRDRAW be done with VB.net?

    09-12-2005 04:13 PM in reply to: *James Maeding
    Hi James,

    There was a similar post where no one could suggest a .NET API equivalent of GRDRAW or GRVECS. http://discussion.autodesk.com/thread.jspa?threadID=420998

    If there is no equivalent I have an example of using GRVECS in VBA which you may be able to use this approach with VB.NET. http://discussion.autodesk.com/thread.jspa?messageID=3955682

    Regards - Nathan
    Please use plain text.
    *James Maeding

    Re: Can GRDRAW be done with VB.net?

    09-12-2005 05:29 PM in reply to: *James Maeding
    cool, I have been looking for that code for a while.
    I need that for VB6.

    I installed .net finally, and opened the hello world sample that was in the objectarx SDK.

    I opened the object browser and looked at the acdbg or whatever libraries and found the jig method.
    I have a feeling calling the activex grvecs will be too slow for things that draw a lot of temp vectors.

    Surely this is not something only lisp can do! I would think some sharp C programmer could tell me how to do grvecs and
    more with .net - or maybe the .net API is not fully baked...

    James Maeding
    |>I do tons of grdraw type stuff with lisp.
    |>I am looking at if the .net API will allow me to draw temprary vectors like grdraw did.
    |>
    |>I am guessing this has been answered before but did not find it in this group.
    |>
    |>In addition, teach me to fish.
    |>How should I have investigated this on my own?
    |>I am a pretty good VB6 writer, and learning VB.net and how the frameworks "work" for any language.
    |>
    |>But this would be a great case study I could learn from.
    |>
    |>Shoul I be looking at some help file showing an object model for the .net acad API?
    |>I downloaded the objectarx sdk help files, not sure if that applies to using VB.net though.
    |>
    |>or should I have visual studio.net installed and reference the right dll's (or frameworks...) and look in the object
    |>browser there?
    |>
    |>how do real programmers walk through the .net API for acad to see whats in it?
    |>feel free to redirect me to other threads, this has to have been talked about before...
    |>
    |>Thanks in advance.
    |>
    |>James Maeding
    |>Civil Engineer and Programmer
    |>jmaeding - athunsaker - com

    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    *Maksim Sestic

    Re: Can GRDRAW be done with VB.net?

    09-13-2005 12:47 AM in reply to: *James Maeding

    James,

     

    I had similar problem since 2006 is
    currently not an option for me. In 2005 there is no managed AcEdJig class, so I
    had to use P/Invoke interop to call C++ APIs directly. Here is a
    function definition (VB.NET) - it does exactly what GRDRAW does in
    Lisp:

     


    <DllImport("acad.exe",
    EntryPoint:="acedGrDraw", CallingConvention:=CallingConvention.Cdecl)>
    _


    Public
    color=#0000ff>Shared
    Function acedGrDraw(
    color=#0000ff>ByVal
    fromPoint As
    color=#0000ff>Double
    (), ByVal toPoint
    color=#0000ff>As
    Double(),
    color=#0000ff>ByVal
    color As
    color=#0000ff>Integer
    , ByVal hl
    color=#0000ff>As
    Integer)
    color=#0000ff>As
    Integer



    color=#0000ff>End

    color=#0000ff>Function


    Note: fromPoint and toPoint are
    three-element arrays of doubles. For color and hl (Highlight) value
    definitions browse through the ObjectARX documentation. Furthermore,
    you can implement Point3D class and enumerators for fromPoint, toPoint,
    color and hl parameters.

     

    Regards,

    Maksim Sestic

     

     

     

     

    "James Maeding" <jmaeding...hunsaker...com>
    wrote in message

    face=Verdana size=2>news:4953556@discussion.autodesk.com

    face=Verdana size=2>...
    I do tons of
    grdraw type stuff with lisp.
    I am looking at if the .net API will allow me to
    draw temprary vectors like grdraw did.

    I am guessing this has been
    answered before but did not find it in this group.

    In addition, teach me
    to fish.
    How should I have investigated this on my own?
    I am a pretty good
    VB6 writer, and learning VB.net and how the frameworks "work" for any
    language.

    But this would be a great case study I could learn
    from.

    Shoul I be looking at some help file showing an object model for
    the .net acad API?
    I downloaded the objectarx sdk help files, not sure if
    that applies to using VB.net though.

    or should I have visual studio.net
    installed and reference the right dll's (or frameworks...) and look in the
    object
    browser there?

    how do real programmers walk through the .net
    API for acad to see whats in it?
    feel free to redirect me to other threads,
    this has to have been talked about before...

    Thanks in
    advance.

    James Maeding
    Civil Engineer and Programmer
    jmaeding -
    athunsaker - com
    Please use plain text.
    *James Maeding

    Re: Can GRDRAW be done with VB.net?

    09-13-2005 08:27 AM in reply to: *James Maeding
    oh wow, now we are talking!
    This is huge because this was the main thing preventing me from spending time learning .net.
    Thank you so much! I am sure others out there are drooling at this.

    Now I just need to learn how all this .net stuff works. Its really diffferent than VB6 activex programming.


    Maksim Sestic

    James,

    I had similar problem since 2006 is currently not an option for me. In 2005 there is no managed AcEdJig class, so I had
    to use P/Invoke interop to call C++ APIs directly. Here is a function definition (VB.NET) - it does exactly what GRDRAW
    does in Lisp:

    _

    Public Shared Function acedGrDraw(ByVal fromPoint As Double(), ByVal toPoint As Double(), ByVal color As Integer, ByVal
    hl As Integer) As Integer

    End Function

    Note: fromPoint and toPoint are three-element arrays of doubles. For color and hl (Highlight) value definitions browse
    through the ObjectARX documentation. Furthermore, you can implement Point3D class and enumerators for fromPoint,
    toPoint, color and hl parameters.

    Regards,
    Maksim Sestic


    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    *Maksim Sestic

    Re: Can GRDRAW be done with VB.net?

    09-13-2005 11:56 PM in reply to: *James Maeding

    Being a
    VB6 developer myself, I can tell that .NET programming concepts are
    getting much deeper than that :-) Frankly, I didn't care much about programming
    languages since I was working on my own, and my code did what it was
    supposed to do. As soon as I gathered team of guys working on the same project
    I stumbled into a problem also known as "DLL Hell" (
    href="http://www.google.com/search?hl=en&q=DLL+Hell">http://www.google.com/search?hl=en&q=DLL+Hell
    ).
    DotNET was the only viable solution apart from all of us learning the same
    programming language.

     

    A word or two on .NET concepts... You
    will have to revise A LOT of what you currently know about programming
    techniques :-) Language syntax itself is the easiest part. Some people
    say that it's "real OOP", my conclusion was that now it takes much more time to
    plan and considerably less time to code. Plain and simple. Take a look at
    the following links on VB.NET programming, it might give you a hint where to
    start from:

     








     

    Regards,

    Maksim Sestic

     

     

     

    "James Maeding" <jmaeding...hunsaker...com>
    wrote in message

    face=Verdana size=2>news:4954606@discussion.autodesk.com

    face=Verdana size=2>...
    oh wow, now we are
    talking!
    This is huge because this was the main thing preventing me from
    spending time learning .net.
    Thank you so much! I am sure others out there
    are drooling at this.

    Now I just need to learn how all this .net stuff
    works.  Its really diffferent than VB6 activex
    programming.


    Maksim Sestic <

    href="mailto:info@geoinova.com">
    size=2>info@geoinova.com

    size=2>>

    James,
     
    I had similar problem since 2006 is
    currently not an option for me. In 2005 there is no managed AcEdJig class, so I
    had
    to use P/Invoke interop to call C++ APIs directly. Here is a function
    definition (VB.NET) - it does exactly what GRDRAW
    does in
    Lisp:
     
    <DllImport("acad.exe", EntryPoint:="acedGrDraw",
    CallingConvention:=CallingConvention.Cdecl)> _

    Public Shared Function
    acedGrDraw(ByVal fromPoint As Double(), ByVal toPoint As Double(), ByVal color
    As Integer, ByVal
    hl As Integer) As Integer

    End Function

    Note:
    fromPoint and toPoint are three-element arrays of doubles. For color and hl
    (Highlight) value definitions browse
    through the ObjectARX documentation.
    Furthermore, you can implement Point3D class and enumerators for
    fromPoint,
    toPoint, color and hl parameters.
     
    Regards,
    Maksim
    Sestic


    James Maeding
    Civil Engineer and Programmer
    jmaeding -
    athunsaker - com
    Please use plain text.
    *James Maeding

    Re: Can GRDRAW be done with VB.net?

    09-14-2005 09:09 AM in reply to: *James Maeding
    Thanks for the comments, those are good links. I know what you mean about the dll hell. Dan Appleman did a good book
    on the differences between vb6 and .net, and the wrox vb.net book is good too.

    Can you explin a little what you mean by it taking more time to plan.
    Do you mean if you have a team on a project and need to plan how things get split up, or do you mean there are lots of
    ways of using the various frameworks, and I need to choose carefully?
    any help appreciated.

    Also, can that dll import trick be done to work with vb6? I have progs in VB6 I would like to add that grdraw
    capability to.
    thx



    Being a VB6 developer myself, I can tell that .NET programming concepts are getting much deeper than that :-) Frankly, I
    didn't care much about programming languages since I was working on my own, and my code did what it was supposed to do.
    As soon as I gathered team of guys working on the same project I stumbled into a problem also known as "DLL Hell"
    (http://www.google.com/search?hl=en&q=DLL+Hell). DotNET was the only viable solution apart from all of us learning the
    same programming language.

    A word or two on .NET concepts... You will have to revise A LOT of what you currently know about programming techniques
    :-) Language syntax itself is the easiest part. Some people say that it's "real OOP", my conclusion was that now it
    takes much more time to plan and considerably less time to code. Plain and simple. Take a look at the following links on
    VB.NET programming, it might give you a hint where to start from:

    - The Code Project (http://www.codeproject.com/vb/net/)
    - vbCity/DevCity.NET Forums (http://www.vbcity.com/forums/faq.asp?fid=15)
    - VB.NET Heaven (http://www.vbdotnetheaven.com/)
    - DevX VB.NET Articles (http://www.devx.com/dotnet/Door/10587)
    - Xtreme VB Talk (http://www.xtremevbtalk.com)
    - DeveloperFusion (http://www.developerfusion.co.uk/vbnet/)
    - Microsoft VB Developer Center (http://www.msdn.microsoft.com/vbasic/)

    Regards,
    Maksim Sestic

    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    *Maksim Sestic

    Re: Can GRDRAW be done with VB.net?

    09-15-2005 12:02 AM in reply to: *James Maeding
    James,

    The very same thing should work in VB6 too. By "planning" I actually ment
    planning within the scope of new functionalities offered by Framework
    itself. I don't say in VB6 you don't need to plan certain approach, I just
    say that it pays back triple in .NET :-)

    Regards,
    Maksim Sestic


    "James Maeding" wrote in message
    news:4956162@discussion.autodesk.com...
    Thanks for the comments, those are good links. I know what you mean about
    the dll hell. Dan Appleman did a good book
    on the differences between vb6 and .net, and the wrox vb.net book is good
    too.

    Can you explin a little what you mean by it taking more time to plan.
    Do you mean if you have a team on a project and need to plan how things get
    split up, or do you mean there are lots of
    ways of using the various frameworks, and I need to choose carefully?
    any help appreciated.

    Also, can that dll import trick be done to work with vb6? I have progs in
    VB6 I would like to add that grdraw
    capability to.
    thx



    Being a VB6 developer myself, I can tell that .NET programming concepts are
    getting much deeper than that :-) Frankly, I
    didn't care much about programming languages since I was working on my own,
    and my code did what it was supposed to do.
    As soon as I gathered team of guys working on the same project I stumbled
    into a problem also known as "DLL Hell"
    (http://www.google.com/search?hl=en&q=DLL+Hell). DotNET was the only viable
    solution apart from all of us learning the
    same programming language.

    A word or two on .NET concepts... You will have to revise A LOT of what you
    currently know about programming techniques
    :-) Language syntax itself is the easiest part. Some people say that it's
    "real OOP", my conclusion was that now it
    takes much more time to plan and considerably less time to code. Plain and
    simple. Take a look at the following links on
    VB.NET programming, it might give you a hint where to start from:

    - The Code Project (http://www.codeproject.com/vb/net/)
    - vbCity/DevCity.NET Forums (http://www.vbcity.com/forums/faq.asp?fid=15)
    - VB.NET Heaven (http://www.vbdotnetheaven.com/)
    - DevX VB.NET Articles (http://www.devx.com/dotnet/Door/10587)
    - Xtreme VB Talk (http://www.xtremevbtalk.com)
    - DeveloperFusion (http://www.developerfusion.co.uk/vbnet/)
    - Microsoft VB Developer Center (http://www.msdn.microsoft.com/vbasic/)

    Regards,
    Maksim Sestic

    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    *Albert Szilvasy

    Re: Can GRDRAW be done with VB.net?

    09-16-2005 03:48 PM in reply to: *James Maeding
    No unfurtunately the same thing won't work in VB6. VB6 can only do stdcall
    calling convention and this function is exported from autocad using the
    cdecl calling convention.

    Albert

    "Maksim Sestic" wrote in message
    news:4956942@discussion.autodesk.com...
    James,

    The very same thing should work in VB6 too. By "planning" I actually ment
    planning within the scope of new functionalities offered by Framework
    itself. I don't say in VB6 you don't need to plan certain approach, I just
    say that it pays back triple in .NET :-)

    Regards,
    Maksim Sestic


    "James Maeding" wrote in message
    news:4956162@discussion.autodesk.com...
    Thanks for the comments, those are good links. I know what you mean about
    the dll hell. Dan Appleman did a good book
    on the differences between vb6 and .net, and the wrox vb.net book is good
    too.

    Can you explin a little what you mean by it taking more time to plan.
    Do you mean if you have a team on a project and need to plan how things get
    split up, or do you mean there are lots of
    ways of using the various frameworks, and I need to choose carefully?
    any help appreciated.

    Also, can that dll import trick be done to work with vb6? I have progs in
    VB6 I would like to add that grdraw
    capability to.
    thx



    Being a VB6 developer myself, I can tell that .NET programming concepts are
    getting much deeper than that :-) Frankly, I
    didn't care much about programming languages since I was working on my own,
    and my code did what it was supposed to do.
    As soon as I gathered team of guys working on the same project I stumbled
    into a problem also known as "DLL Hell"
    (http://www.google.com/search?hl=en&q=DLL+Hell). DotNET was the only viable
    solution apart from all of us learning the
    same programming language.

    A word or two on .NET concepts... You will have to revise A LOT of what you
    currently know about programming techniques
    :-) Language syntax itself is the easiest part. Some people say that it's
    "real OOP", my conclusion was that now it
    takes much more time to plan and considerably less time to code. Plain and
    simple. Take a look at the following links on
    VB.NET programming, it might give you a hint where to start from:

    - The Code Project (http://www.codeproject.com/vb/net/)
    - vbCity/DevCity.NET Forums (http://www.vbcity.com/forums/faq.asp?fid=15)
    - VB.NET Heaven (http://www.vbdotnetheaven.com/)
    - DevX VB.NET Articles (http://www.devx.com/dotnet/Door/10587)
    - Xtreme VB Talk (http://www.xtremevbtalk.com)
    - DeveloperFusion (http://www.developerfusion.co.uk/vbnet/)
    - Microsoft VB Developer Center (http://www.msdn.microsoft.com/vbasic/)

    Regards,
    Maksim Sestic

    James Maeding
    Civil Engineer and Programmer
    jmaeding - athunsaker - com
    Please use plain text.
    *Maksim Sestic

    Re: Can GRDRAW be done with VB.net?

    09-17-2005 03:11 AM in reply to: *James Maeding

    Albert, you're right. I figured it out while
    trying to reproduce that API call from VB6... James, I guess you can still write
    acedGrDraw function (as explained) in VB.NET, exposing it to VB6 via COM
    Interop.

     

    Useful links on exposing COM Interfaces of .NET
    classes:

     





     

    Regards,

    Maksim Sestic

     


    size=2>
     

     

    No unfurtunately
    the same thing won't work in VB6. VB6 can only do stdcall
    calling convention
    and this function is exported from autocad using the
    cdecl calling
    convention.

    Albert

    "Maksim Sestic" <

    href="mailto:info@geoinova.com">
    size=2>info@geoinova.com
    > wrote in
    message

    face=Verdana size=2>news:4956942@discussion.autodesk.com

    face=Verdana size=2>...
    James,

    The very same thing should work in VB6
    too. By "planning" I actually ment
    planning within the scope of new
    functionalities offered by Framework
    itself. I don't say in VB6 you don't
    need to plan certain approach, I just
    say that it pays back triple in .NET
    :-)

    Regards,
    Maksim Sestic


    "James Maeding"
    <jmaeding...hunsaker...com> wrote in message

    href="news:4956162@discussion.autodesk.com">
    size=2>news:4956162@discussion.autodesk.com

    size=2>...
    Thanks for the comments, those are good links.  I know what
    you mean about
    the dll hell.  Dan Appleman did a good book
    on the
    differences between vb6 and .net, and the wrox vb.net book is
    good
    too.

    Can you explin a little what you mean by it taking more time
    to plan.
    Do you mean if you have a team on a project and need to plan how
    things get
    split up, or do you mean there are lots of
    ways of using the
    various frameworks, and I need to choose carefully?
    any help
    appreciated.

    Also, can that dll import trick be done to work with
    vb6?  I have progs in
    VB6 I would like to add that grdraw
    capability
    to.
    thx



    Being a VB6 developer myself, I can tell that .NET
    programming concepts are
    getting much deeper than that :-) Frankly,
    I
    didn't care much about programming languages since I was working on my
    own,
    and my code did what it was supposed to do.
    As soon as I gathered
    team of guys working on the same project I stumbled
    into a problem also known
    as "DLL Hell"
    (

    href="http://www.google.com/search?hl=en&q=DLL+Hell">
    size=2>http://www.google.com/search?hl=en&q=D...

    face=Verdana size=2>). DotNET was the only viable
    solution apart from all of
    us learning the
    same programming language.

    A word or two on .NET
    concepts... You will have to revise A LOT of what you
    currently know about
    programming techniques
    :-) Language syntax itself is the easiest part. Some
    people say that it's
    "real OOP", my conclusion was that now it
    takes much
    more time to plan and considerably less time to code. Plain and
    simple. Take
    a look at the following links on
    VB.NET programming, it might give you a hint
    where to start from:

    - The Code Project (

    href="http://www.codeproject.com/vb/net/">
    size=2>http://www.codeproject.com/vb/net/

    size=2>)
    - vbCity/DevCity.NET Forums (

    href="http://www.vbcity.com/forums/faq.asp?fid=15">
    size=2>http://www.vbcity.com/forums/faq.asp?fid...

    size=2>)
    - VB.NET Heaven (

    href="http://www.vbdotnetheaven.com/">
    size=2>http://www.vbdotnetheaven.com/
    )
    -
    DevX VB.NET Articles (

    href="http://www.devx.com/dotnet/Door/10587">
    size=2>http://www.devx.com/dotnet/Door/10587

    size=2>)
    - Xtreme VB Talk (

    face=Verdana size=2>http://www.xtremevbtalk.com

    size=2>)
    - DeveloperFusion (

    href="http://www.developerfusion.co.uk/vbnet/">
    size=2>http://www.developerfusion.co.uk/vbnet/

    size=2>)
    - Microsoft VB Developer Center (

    href="http://www.msdn.microsoft.com/vbasic/">
    size=2>http://www.msdn.microsoft.com/vbasic/

    size=2>)

    Regards,
    Maksim Sestic

    James Maeding
    Civil Engineer
    and Programmer
    jmaeding - athunsaker - com
    Please use plain text.