[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Entities and SelectionSets

Posted on 2006-11-13
2
Medium Priority
?
752 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If, like me, you find yourself repeatedly and tediously joining many segments (lines, arcs) in other people's drawings back into polylines that can be used more effectively in Computer Aided Machining and Laser Cutting, then this article is for you!…
The following article will describe how to add/edit a dimension style through AutoCAD VBA. AutoCAD VBA has its quirks and when it comes to dimensions and controlling how they look through VBA.  This is where AutoCAD can be vividly confusing. The…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

656 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