Hi all,
Please help me to find Points inside Shape Element.
The points are which is marked by Blue color circle.I was tried with below code, but its creating duplicate boundary.Please correct me or suggest easy way.
if Ele.IsShapeElement Then Set EleS = Oenum.Current Set oFen = ActiveDesignFile.Fence oFen.Undefine Set myView = CommandState.LastView oFen.DefineFromElement myView, Ele ActiveSettings.FenceClip = True oFen.Draw If oFen.IsDefined Then Set OSepnt = oFen.GetContents OSepnt.Reset i = 0 Do While OSepnt.MoveNext Set Elele = OSepnt.Current If Elele.IsLineElement Then If Elele.Level.Name = "Building Point" Then i = i + 1 End If If i = 1 Then MsgBox "Ok" Else MsgBox "duplicate point" End If End If Loop End If Else End If
Thanks
Regards,
Venugopal
Unknown said:I was tried with below code, but it's creating a duplicate boundary
Since your code doesn't create any elements, I don't see how it can create a duplicate boundary.
Your fence logic looks about right. You should explain your decision criteria where you're looking for a line (presumably a zero-length line, although you don't test for that) on level "Building Point". What makes a duplicate point?
Regards, Jon Summers LA Solutions
Hi Jon,
I have attached my dgn file and my code.My Aim is to find missing point inside Permanent building.If there is no point inside the building i need mark a circle.Please test my macro and correct me where i did mistack.
Unknown said:Please test my macro and correct me where I did mistake
The people who respond to questions on Be Communities are not here to provide a free debugging service. You are responsible for developing and testing your code.
What isn't working? Have you stepped through your code using VBA's debug mode? Use VBA statements Debug.Print and Debug.Assert during development.
Break long code segments into smaller units: subroutines and functions enable that approach. VBA's classes are another way of encapsulating pieces of code that have a well-defined interface.
Thanks for your advice.I will try myself.
Regards
venugopal
For your information, if we use ActiveSettings.FenceClip = True then its creating duplicate line strings.
Unknown said:If we use ActiveSettings.FenceClip = True then its creating duplicate line strings
For your information, setting the fence mode does not create elements. A fence filters elements. Unless you create an element as a result of the fence operation, then merely creating a fence will not duplicate anything.
I repeat: the code you posted does not create any elements. How can ActiveSettings.FenceClip create an element, unless there is more code that you have not posted?
Hi jon,
FYI, Please read below message.I got from the link
http://discussion.bentley.com/cgi-bin/dnewsweb.exe?cmd=article&group=bentley.microstation.v8.vba&item=5907&utag=
Warning! read the section in help on the Fence GetContents Method! If Fence Clip is enabled, you will be making copies and/or modifying elements and not know it. Many people have decided that the Fence.GetContents Method is an excellent way to do what you are wanting to do. However, many of them have also ended up with tons of duplicate and cut elements in their files.
Personally, I really dislike the fact that this method can modify your existing design file.
Gerald
Venu
Unknown said: I really dislike the fact that this method can modify your existing design file
My apologies. Now I understand a little better what you have done your problem is more obvious.
Why have you set the fence mode to clip? If you're looking for points inside a shape, you don't want to clip anything.
Another option is to use Point3dInPolygonXY.
I have finished my task with ActiveSettings.Fenceoverlap = True. Just I want to inform that .Fenceclip is creating duplicate.Thanks