VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PromptEntityResult VB6.0

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
606 Views, 5 Replies

PromptEntityResult VB6.0

Hello,

 

I'm using Autocad 2010 with VB6.0.

 

I want to use .Net function "PromptEntityResult" in vb6.0.

 

could you explain me how can I use that function in vb6.0 or

what is equivalent function for PromptEntityResult in vb6.0

 

 

Thanks in advance,

thenndral

 

5 REPLIES 5
Message 2 of 6
Hallex
in reply to: Anonymous

See example, not mine just converted on VB.NET:

        <CommandMethod("lx")> _
        Public Shared Sub GetEntityExample()

            ''converted fro C# code writen by TT
            Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            Dim peo As New PromptEntityOptions(vbLf & "Select a line: ")
            peo.SetRejectMessage(vbLf & "Not a line...")
            peo.AddAllowedClass(GetType(Line), True)
            Dim per As PromptEntityResult = ed.GetEntity(peo)
            If per.Status <> PromptStatus.OK Then
                Return
            End If

            Dim ppo As New PromptPointOptions(vbLf & "Specify a point: ")
            ppo.AllowNone = True
            Dim tm As Autodesk.AutoCAD.ApplicationServices.TransactionManager = doc.TransactionManager
            tm.EnableGraphicsFlush(True)
            Using tr As Transaction = tm.StartTransaction()
                Dim ln As Line = DirectCast(per.ObjectId.GetObject(OpenMode.ForRead), Line)
                Dim btr As BlockTableRecord = DirectCast(doc.Database.CurrentSpaceId.GetObject(OpenMode.ForWrite), BlockTableRecord)

                Try
                    While True
                        Dim ppr As PromptPointResult = ed.GetPoint(ppo)
                        If ppr.Status <> PromptStatus.OK Then
                            Exit While
                        End If
                        If ppr.Value = Point3d.Origin Then
                            Continue While
                        End If
                        Dim pt As Point3d = ppr.Value

                        Dim nl As New Line(pt, ln.EndPoint)
                        ln.ColorIndex = 121
                        btr.AppendEntity(nl)
                        tm.AddNewlyCreatedDBObject(nl, True)
                        tm.QueueForGraphicsFlush()
                        tm.FlushGraphics()
                        ed.UpdateScreen()
                    End While
                Finally
                    tr.Commit()
                End Try
            End Using
        End Sub

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 6
Anonymous
in reply to: Hallex

Hello Hallex,

 

Thanks for your reply.

 

I mean, I would like to know the equivalent function for PromptEntityResult  in VB 6.0

 

I'm using Autocad 2010 with VB6.0.

 

 

Thanks in advance,

thenndral

 

Message 4 of 6
Hallex
in reply to: Anonymous

Oops, sorry
I can't use VB.6, just VB.NET
_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 5 of 6
Alfred.NESWADBA
in reply to: Anonymous

Hi,

 

I don't know an exactly replacement for PromptEntityResult as this is not available in the COM-API of AutoCAD.

If you just search a version of entity-selection you might check the Utility.GetEntity method (you find some dotNET to VBA comparisions >>>here<<<).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 6 of 6
Anonymous
in reply to: Alfred.NESWADBA

Hi,

 

Thanks  for your reply.

Let me search in  entity-selection area.

 

Thanks again,

thenndral

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

Post to forums  

Autodesk Design & Make Report

”Boost