twk Posted November 17, 2015 Share Posted November 17, 2015 Anyone else notice issues with using the vs.IsPolyClosed or vs.GetVertexVisibility Functions? Here's what's happening: Where Last Segment is Hidden Case of Polygon If the [poly is a polygon] and [last vertex/segment is hidden] then the vs.IsPolyClosed call returns [False] -BUT- the vs.GetVertexVisibility call returns the last vertex/segment as visible(True). When really it should be reporting as hidden? Case of Polyline If the [poly is a polyline] and [last vertex/segment is hidden] then the vs.IsPolyClosed call returns [False]. -AND- the vs.GetVertexVisibility call returns the last vertex/segment as hidden(False). Which is CORRECT. Where Last Segment is Visible, but any other segment is Hidden BOTH SITUATIONS OF POLYLINE OR POLYGON Whatever segment/vertex is hidden is reporting as hidden using vs.GetVertextVisibility, but the vs.IsPolyClosed is reporting as True, when really it should be False? Here's my script below that tests these functions on either polyline or polygon, advice on corrections are welcome: h = vs.FSActLayer() PolyTypes = [5, 21] cntr = vs.HCenter(h) if vs.GetTypeN(h) in PolyTypes: chkClosed = vs.IsPolyClosed(h) cntrStr = 'Is Closed :' + str(chkClosed) vs.MoveTo(cntr) vs.CreateText(cntrStr) NVerts = vs.GetVertNum(h) #vs.Message(str(NVerts)) for vrtx in range(1, NVerts+1): check = vs.GetVertexVisibility(h, vrtx-1) pts = vs.GetPolyPt(h, vrtx) vs.MoveTo(pts) dispStr = 'vertextNum : '+str(vrtx) + ', '+ vs.Chr(13) + 'Visible : '+str(check) vs.CreateText(dispStr) #vs.Locus(pts) vs.SetDSelect(h) Script basically: 1. Checks whether Selected obj is a Poly 2. Places text objects with info vertex number, and visibility 3. Plus text on the center of the Poly saying whether it's closed or not {Using VW2015 SP4} Thanks Tui Quote Link to comment
Dieter @ DWorks Posted November 17, 2015 Share Posted November 17, 2015 (edited) Lol, I reported this issue years ago.... These two calls just behave differently for polylines and polygons, as they are basically different objects.... It's strange for the last segment, I know. Also Hidden or Closed are two different concepts in VW. Maybe you can wrap these calls in dlibrary dlibrary, so scripters shouldn't worry about that anymore? You can create a pull request if you like, and then we can include it. Edited November 17, 2015 by Dieter @ DWorks Quote Link to comment
twk Posted November 17, 2015 Author Share Posted November 17, 2015 Thanks for the response Dieter. I guess it would be good to add them to the dlibrary. Unfortunatley, I am very new to coding, having just taught myself python over the last couple of months through the plethora of free online tutorials. Coming from a vectorscript background many concepts of object orientated programming have been hard to grasp. Like classes and abstract classes!? In saying that I really appreciate your library you've shared and I have been skimming over your code there trying to figure out what each call does etc, and going over my own notes. And I'm slowly learning. I only mention this because I know you've been mentioning to me to look at your library (in my last couple of posts) Appreciate your help. In between learning python I have tried to get into git/version control and that too is a bit over my head.. [pull requests?!commits!?] I guess in time I'll wrap my head around it. Thanks again Tui Quote Link to comment
Dieter @ DWorks Posted November 18, 2015 Share Posted November 18, 2015 (edited) Thanks for the response Dieter. I guess it would be good to add them to the dlibrary. Unfortunatley, I am very new to coding, having just taught myself python over the last couple of months through the plethora of free online tutorials. Coming from a vectorscript background many concepts of object orientated programming have been hard to grasp. Like classes and abstract classes!? In saying that I really appreciate your library you've shared and I have been skimming over your code there trying to figure out what each call does etc, and going over my own notes. And I'm slowly learning. I only mention this because I know you've been mentioning to me to look at your library (in my last couple of posts) Appreciate your help. In between learning python I have tried to get into git/version control and that too is a bit over my head.. [pull requests?!commits!?] I guess in time I'll wrap my head around it. Thanks again Tui That's no problem. I also learned Python over the last year and a half. though I have a lot of experience with other OO languages. If there are things you don't understand, then ask, I'll help out, even add more comments in code for things that aren't clear. I'm also busy on getting documentation for dlibrary, so please tell all problems, create issues on the public issue tracker, so that there can be examples and docs created for the specific problems you and others have with it. EDIT: Ow, and I do believe that there can be more learned by doing things yourself, that's why I don't always deliver the solution right away, so please go ahead and try, then I, and others, can comment on your code on the specific things you have troubles with, instead of pages of how to program in general. Even if the code doesn't work, or if your code is just build out of comments that tell what you want to do.... Edited November 18, 2015 by Dieter @ DWorks Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.