?
Solved

Entities and SelectionSets

Posted on 2006-11-13
2
Medium Priority
?
746 Views
Last Modified: 2008-01-09
when I try to run this program I get a "Automation Error, Catastrophic Failure" error, stopping at the "for each ent in sset" like, can someone please help?

Dim sset As AcadSelectionSet

Private Sub UpdateFields()
    edtCount.Text = sset.Count & " Objekte"
    btGo.Enabled = (sset.Count > 0)
End Sub

Private Sub btGo_Click()
  UserForm1.hide
  Dim nowpt As AcadPoint
  Dim nowtx As AcadText
  Dim nowmtx As AcadMText
  Dim newpt(1 To 3) As Double
  Dim ent As AcadEntity
  For Each ent In sset
    If (TypeName(ent) = "IAcadText2") Then
      Set nowtx = ent
      newpt(1) = nowtx.InsertionPoint(0) + edtDX.Text
      newpt(2) = nowtx.InsertionPoint(1) + edtDY.Text
      newpt(3) = Trim(nowtx.TextString)
      ThisDrawing.ActiveLayer = CheckLayer("NEWPOINTS")
      ThisDrawing.ModelSpace.AddPoint newpt
    End If
    If (TypeName(ent) = "IAcadMText2") Then
      Set nowmtx = ent
      newpt(1) = nowmtx.InsertionPoint(0) + edtDX.Text
      newpt(2) = nowmtx.InsertionPoint(1) + edtDY.Text
      newpt(3) = Trim(nowmtx.TextString)
      ThisDrawing.ActiveLayer = CheckLayer("NEWPOINTS")
      ThisDrawing.ModelSpace.AddPoint newpt
    End If
  Next ent
  sset.Delete
End Sub

Private Sub CommandButton1_Click()
    UserForm1.hide
'    For I = 0 To ThisDrawing.SelectionSets.Count - 1
'        ThisDrawing.SelectionSets(I).Delete
'    Next I
    Set sset = ThisDrawing.SelectionSets.Add("MySetMP")
    sset.SelectOnScreen
    UpdateFields
    UserForm1.Show
End Sub

Private Sub CommandButton2_Click()
    sset.Clear
    UpdateFields
End Sub

Private Sub CommandButton4_Click()
    Me.hide
End Sub
0
Comment
Question by:simtech2007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 14

Accepted Solution

by:
Tommy Kinard earned 250 total points
ID: 17947595
Hi simtech2007,

I see a couple of problems when I try to run this macro in 2000i.

edtDX.Text, edtDY.Text are not defined before use - at least in the code posted,

If (TypeName(ent) = "IAcadText2") Then

should be

If TypeOf ent Is AcadText Then

"Automation Error, Catastrophic Failure" error <-- may be because the sset object has not been created, check to see if it exists before use

dragontooth

0
 
LVL 1

Author Comment

by:simtech2007
ID: 17947670
YOU WON....

not because it's right, but I've found out that the catastrophic error was just a problem of AutoCAD itself, i.e. re-install and it's ok :)

but since you're the first who answered, you're the winner
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Our company has proprietary drawing files that we do not give to our customers for final documentation. Our customers now require that we give them these drawings. They understand that they are proprietary and do not require them to be in AutoCAD bu…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question