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

GetObject zoom back

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
262 Views, 6 Replies

GetObject zoom back

Hi

When I use GetObject and zoom before I select the object, autocad zoom back
to the veiw it was before I zoom

Does anybody know how to solve this?

Thank
Rune
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Can't help you with nothing but a brief description.

Post the part of the code where the problem is, and
maybe we can help you.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Rune Aarnes" wrote in message
news:6290200@discussion.autodesk.com...
Hi

When I use GetObject and zoom before I select the object, autocad zoom back
to the veiw it was before I zoom

Does anybody know how to solve this?

Thank
Rune
Message 3 of 7
Anonymous
in reply to: Anonymous

Sorry I ment GetEntity. Here is a code sample

Dim ent As Entity = Nothing
Dim optEnt As PromptEntityOptions
Dim resEnt As PromptEntityResult
Dim tr As Transaction = _db.TransactionManager.StartTransaction
Try
optEnt = New PromptEntityOptions(vbNewLine & message)
TryAgain:
Do
resEnt = _ed.GetEntity(optEnt)
If resEnt.Status = PromptStatus.Cancel Then Return
Nothing
Loop While resEnt.Status <> PromptStatus.OK

Dim id As ObjectId = resEnt.ObjectId
ent = tr.GetObject(id, OpenMode.ForRead)

If TypeOf ent Is Polyline Then
Return CType(ent, Polyline)
Else
_ed.WriteMessage(vbNewLine & "This is " &
ent.GetType.Name)
GoTo TryAgain
End If






"Tony Tanzillo" skrev i melding
news:6290725@discussion.autodesk.com...
Can't help you with nothing but a brief description.

Post the part of the code where the problem is, and
maybe we can help you.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Rune Aarnes" wrote in message
news:6290200@discussion.autodesk.com...
Hi

When I use GetObject and zoom before I select the object, autocad zoom back
to the veiw it was before I zoom

Does anybody know how to solve this?

Thank
Rune
Message 4 of 7
jerrywinters
in reply to: Anonymous

I tried your code. When I zoom in during the GetEntity, the view stays where it is at when I select the next entity. What version of AutoCAD are you running?

Also, you may want to do something other than the GoTo Statement. Perhaps if you can describe what you are trying to accomplish, step by step, you can get some better help.

Jerry
Message 5 of 7
Anonymous
in reply to: Anonymous

I use this to many different things for example I convert polyline, spline
or arc to polyline3d

I use AutoCAD 2008 and 2010. Same problem with both.

I have now found out that the sub TEST2 works find, but not TEST1



Public Sub TEST1()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK
Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
tr.Dispose()
End Try
End Sub

Public Sub TEST2()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
'Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK


Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
'tr.Dispose()
End Try
End Sub











"jerrywinters" skrev i melding news:6291559@discussion.autodesk.com...
I tried your code. When I zoom in during the GetEntity, the view stays
where it is at when I select the next entity. What version of AutoCAD are
you running?

Also, you may want to do something other than the GoTo Statement. Perhaps
if you can describe what you are trying to accomplish, step by step, you can
get some better help.

Jerry
Message 6 of 7
Anonymous
in reply to: Anonymous

The problem you're having is because you are not calling
Commit() on the transaction.

A Trasaction is aborted when you call Dispose() on it,
without previously calling Commit().

Aborting a transaction causes *all* changes to a database
that occured within the transaction to be undone, including
changes to the view.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Rune Aarnes" wrote in message
news:6292190@discussion.autodesk.com...
I use this to many different things for example I convert polyline, spline
or arc to polyline3d

I use AutoCAD 2008 and 2010. Same problem with both.

I have now found out that the sub TEST2 works find, but not TEST1



Public Sub TEST1()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK
Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
tr.Dispose()
End Try
End Sub

Public Sub TEST2()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
'Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK


Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
'tr.Dispose()
End Try
End Sub











"jerrywinters" skrev i melding news:6291559@discussion.autodesk.com...
I tried your code. When I zoom in during the GetEntity, the view stays
where it is at when I select the next entity. What version of AutoCAD are
you running?

Also, you may want to do something other than the GoTo Statement. Perhaps
if you can describe what you are trying to accomplish, step by step, you can
get some better help.

Jerry
Message 7 of 7
Anonymous
in reply to: Anonymous

Thank you....


"Tony Tanzillo" skrev i melding
news:6292316@discussion.autodesk.com...
The problem you're having is because you are not calling
Commit() on the transaction.

A Trasaction is aborted when you call Dispose() on it,
without previously calling Commit().

Aborting a transaction causes *all* changes to a database
that occured within the transaction to be undone, including
changes to the view.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"Rune Aarnes" wrote in message
news:6292190@discussion.autodesk.com...
I use this to many different things for example I convert polyline, spline
or arc to polyline3d

I use AutoCAD 2008 and 2010. Same problem with both.

I have now found out that the sub TEST2 works find, but not TEST1



Public Sub TEST1()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK
Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
tr.Dispose()
End Try
End Sub

Public Sub TEST2()
Dim resEnt As PromptEntityResult
Dim ed As Editor =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Dim db As Database = ed.Document.Database
'Dim tr As Transaction = db.TransactionManager.StartTransaction
Try
Do
resEnt = ed.GetEntity(vbNewLine & "Select polyline")
If resEnt.Status = PromptStatus.Cancel Then Exit Try
Loop While resEnt.Status <> PromptStatus.OK


Catch ex As System.Exception
MessageBox.Show(ex.Message, "System.Exception",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
'tr.Dispose()
End Try
End Sub











"jerrywinters" skrev i melding news:6291559@discussion.autodesk.com...
I tried your code. When I zoom in during the GetEntity, the view stays
where it is at when I select the next entity. What version of AutoCAD are
you running?

Also, you may want to do something other than the GoTo Statement. Perhaps
if you can describe what you are trying to accomplish, step by step, you can
get some better help.

Jerry

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