Jump to content

vs.isPolyClosed / vs.GetVertexVisibility Functions Error?


twk

Recommended Posts

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

Link to comment

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 by Dieter @ DWorks
Link to comment

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

Link to comment
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 by Dieter @ DWorks
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...