Site Logo
Site Logo
 
It is currently Sun Apr 02, 2017 7:02 pm

All times are UTC [ DST ]




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 
Author Message
 Post subject: problem with entity type
PostPosted: Thu Aug 25, 2016 1:54 pm 
Offline
DELCAM Guru
DELCAM Guru

Joined: Tue Nov 07, 2006 1:16 pm
Posts: 75
Hi,
i've a problem with different type of entity,
i've one line and i must move it in x-10 y0 z0 10 copies and after i must create a circle at start and end point of each line.
the function to move a line return the type " psentity " after the move function i must create a circle at stard and end point of each line but i've not the start point and end point method because the line created are psentity type and not psline type !!!!
I must convert the psentity array in psline array and after i can create circle using start point and end point of each line
thank's .


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 2:46 pm 
Offline
DELCAM Staff
DELCAM Staff

Joined: Tue Mar 17, 2009 2:30 pm
Posts: 108
You should find that although the returned item is a PSEntity it is actually a PSLine. So you can cast it up to the correct type and you can access the parameters:
var line = (PSLine)createdItem[0];


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 3:59 pm 
Offline
DELCAM Guru
DELCAM Guru

Joined: Tue Nov 07, 2006 1:16 pm
Posts: 75
sorry but i don't understand you !!!
i've this code:

Dim linea As PSLine
Dim entita As List(Of PSEntity)
Dim p1 As Point = New Point(10, 0, 0)
Dim p2 As Point = New Point(-10, 0, 0)

entita = linea.MoveBetweenPoints(p1, p2, 10)


entita is an array of psentity type filled of 10 entity
Now i must create a circle at the start and end point of each line.
How can i do this ?


I would like to work with array and not with single command
for example
dim ArrayLinea as list(of psline)
dim ArrayCircle as list (of pscircle)
ArrayLinea = entita
for conta as integer = 0 to ArrayLinea.count-1
ArrayCircle = ps.createcircle (ArrayLinea(conta).startpoint)
ArrayCircle = ps.createcircle (ArrayLinea(conta).endpoint)
next

but is not possibile do ArrayLinea = entita

Thank's tank's tank's


Last edited by psx2 on Thu Aug 25, 2016 4:06 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 4:04 pm 
Offline
DELCAM Staff
DELCAM Staff

Joined: Tue Mar 17, 2009 2:30 pm
Posts: 108
If you were to do:
Dim aLine As PSLine = DirectCast(entita(0), PSLine)

Then you could now access the start and end points of the "aLine". Iterate through the list of entities in entita to access them in turn.


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 4:11 pm 
Offline
DELCAM Guru
DELCAM Guru

Joined: Tue Nov 07, 2006 1:16 pm
Posts: 75
but in this mode i iterate ?
an example please ?


tank's


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 4:44 pm 
Offline
DELCAM Guru
DELCAM Guru

Joined: Tue Nov 07, 2006 1:16 pm
Posts: 75
in this way ?

Dim line(10) As PSLine
For conta As Integer = 0 To en.Count - 1
line(conta) = DirectCast(en(conta), PSLine)
Next



ok ?

thank's


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Thu Aug 25, 2016 5:41 pm 
Offline
DELCAM Staff
DELCAM Staff

Joined: Tue Mar 17, 2009 2:30 pm
Posts: 108
Yes, looks good!


Top
 Profile  
 
 Post subject: Re: problem with entity type
PostPosted: Sat Aug 27, 2016 10:12 am 
Offline
DELCAM Guru
DELCAM Guru

Joined: Tue Nov 07, 2006 1:16 pm
Posts: 75
thank's i've solved in this way:

Dim en As List(Of PSEntity)
Dim linee as list (of PSLine)

For Each item As PSLine In en
linee .Add(item)
Next

it's a kind of implicit cast !


PS: Sorry but do you have any solution for my previous post ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB