Personal tools
You are here: Home Forum Use Multiple arguments for functions

Multiple arguments for functions

Up to Use

Multiple arguments for functions

Posted by Kon G at October 10. 2018

Hello,

I make points with same name "p" followed by a number using a for loop like this:

-----------------------------------------------------------------

nop = 200

step = 0.1

for n in range(0,nop):  
    x    =  float(n) * step
    y    =  x
    pnt = geompy.MakeVertex( x , y , 0)
    geompy.addToStudy(pnt, "p%s"%(n) )
    pass

-----------------------------------------------------------------

 

Then I want to simply make a curve using "geompy.MakeInterpol" utility. How can I do it ? 

Please help me

 

Thank you

GK

Re: Multiple arguments for functions

Posted by Saint Michael at October 10. 2018

Hi GK

nop = 200

step = 0.1

points = []
for n in range(0,nop): 
    x    =  float(n) * step
    y    =  x
    pnt = geompy.MakeVertex( x , y , 0)
    #geompy.addToStudy(pnt, "p%s"%(n) )
    points.append( pnt )
    pass

curve = geompy.MakeInterpol( points )

Re: Multiple arguments for functions

Posted by Kon G at October 11. 2018

Hello Michael,

 

Thank you very much for your reply. Actually, it works fine but when I make the interpolation I get this error:

"MakeInterpol: BSplCLib :: Interpolate" .  If I use the polyline utility everything works but I don't want to use this. I kindly attach my script

 

Thank you

GK

 

 

p, li { white-space:
asd
Attachments

Re: Multiple arguments for functions

Posted by Saint Michael at October 11. 2018

There are duplicates in pnts. See the updated script.

St.Michael

Attachments

Re: Multiple arguments for functions

Posted by Kon G at October 11. 2018
Thank you very much
 
GK

Re: Multiple arguments for functions

Posted by Kon G at October 11. 2018
Hi,
 
Could you please give me some more advice? Although I have too many points, the interpolation line does not pass through all points giving a line that has corners eventually. If you make a zoom in you can check it. Can I do something for this problem?
 
Thank you
GK
 
 
Attachments

Re: Multiple arguments for functions

Posted by Saint Michael at October 11. 2018

I'm sure this is just a visualization effect. You can improve the visualization by decreasing Deflection Coefficient, which is available in the contextual menu of your curve in the Viewer. Set it to 0.000001.

But this influences only on how your curve looks, its internal definition does not change.

St.Michael

Re: Multiple arguments for functions

Posted by Kon G at October 11. 2018

Thank you again you are just a Salome expert.

 

GK

Powered by Ploneboard
Document Actions