.NET

.NET

Reply
Valued Contributor
83 Posts
0 Kudos
Registered: ‎10-07-2005
Post 1 of 3

Selection set with existing entities and with entities that is not saved yet

111 Views, 2 Replies
06-07-2014 09:00 AM

Hello,

Sorry if I am using wrong terms.

I am trying to find intersection of all curves with each other and GetSplitCurves to break from intersection points.

My selection set command is like that:

                        Dim res2 As PromptSelectionResult = ed.SelectCrossingPolygon(Points, New SelectionFilter(New TypedValue() {New TypedValue(0, "line,lwpolyline,polyline,arc,point,circle,insert"), New TypedValue(CInt(DxfCode.LayerName), a)}))

 

And breaking curve is: I tried to remove unnecassary code

Dim horIds As ObjectIdCollection = New ObjectIdCollection(res.Value.GetObjectIds)
Dim ch As Curve = TryCast(tr.GetObject(horIds(i), OpenMode.ForRead), Curve)
.....
Dim objs As DBObjectCollection = ch.GetSplitCurves(pars)
For Each obj As DBObject In objs Dim en As Entity = TryCast(obj, Entity) btr.AppendEntity(en) tr.AddNewlyCreatedDBObject(en, True) horIds.Add(en.ObjectId) ch.UpgradeOpen() ch.[Erase]() Next

 

After breaking there comes new curves, but since transaction.commit is not executed until the end of all run, new curves are not saved and selection set does not find these newly added curves in the next do...loop, and the user must rerun the code several times to find all intersections. I tried to add transaction.commit after the above code re sent to the begging then it works fine but it is so time consuming more than 10x since looking up intersection from the beginning everytime.

How can I do this.

Regards,

 

Windows 7 (x64)
AutoCAD 2012 (x64)
Valued Contributor
83 Posts
0 Kudos
Registered: ‎10-07-2005
Post 2 of 3

Re: Selection set with existing entities and with entities that is not saved yet

06-08-2014 07:13 PM in reply to: tanerpro

The problem is with the SelectCrossingPolygon, if I change it to selectall it finds all newly added objects.

 

                            Dim res2 As PromptSelectionResult = ed.SelectAll(New SelectionFilter(New TypedValue() {New TypedValue(0, "line,lwpolyline,polyline,arc,point,circle" & If(CheckBox11.Checked, ",insert", "")), New TypedValue(CInt(DxfCode.LayerName), a)}))

 

The screen is zoomed to extents, and I tried Application.UpdateScreen() and ed.Regen() before the SelectCrossingPolygon but nothing changed. The polygon boundary is correct I have checked with drawing polyline, and SelectCrossingPolygon also works if the command is executed 2nd or 3rd.... times. The problem is to make it work at 1st time and without selecting unnecessary object like in the selectall.

What can I do?

Windows 7 (x64)
AutoCAD 2012 (x64)
Valued Contributor
83 Posts
0 Kudos
Registered: ‎10-07-2005
Post 3 of 3

Re: Selection set with existing entities and with entities that is not saved yet

06-08-2014 08:58 PM in reply to: tanerpro
Hello ı found the solution that sentence inspired me: "Since changes don't get comitted to the database until the outer-most transaction is comitted"

I deleted nested transactions and put the transaction in the do loop and committed the transaction evertime in the loop.
Windows 7 (x64)
AutoCAD 2012 (x64)
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!