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

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

2 REPLIES 2
Reply
Message 1 of 3
tanerpro
288 Views, 2 Replies

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

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,

 

2 REPLIES 2
Message 2 of 3
tanerpro
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?

Message 3 of 3
tanerpro
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.

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