Author Topic: PerpendicularTo{ <SelectOnly } fails  (Read 3346 times)

bdeck

  • Hero Member
  • *****
  • Posts: 785
PerpendicularTo{ <SelectOnly } fails
« on: November 28, 2008, 03:59:03 PM »
In the PerpendicularTo command:

The "<selectonly 0" parameter  fails. (Noticeable if SelectOnly flag has previously been set, and sys(80)>0).

Also "<selectonly 1" fails. (Noticeable if SelectOnly flag has not been previously set, and sys(80)>0).

See demo in later post.

BD


Code: [Select]


code removed from this post in favor of demo in later post in this thread

« Last Edit: December 04, 2008, 08:29:43 PM by bdeck »

paulerens

  • Hero Member
  • *****
  • Posts: 915
Re: perpendicularto fails if sys(80)>0
« Reply #1 on: November 28, 2008, 06:28:59 PM »
Bdeck, test this first.
This is your code
pertest.d3m

dim x(5), y(5), z(5)
'NE=sys(9)           ' no of entities
sys(1) = 0           ' no of points set
 
Setpoint "Set 3 points for  1) arc center, 2) starting point, 3) direction, 4) end angle", 2

If Sys(1) < 2 Then end

for j = 1 to 2                 
     pointval x(j), y(j), z(j), j             'store point values
next j

sys(36)=1

>Perpendicular To
{
   <SelectOnly 0
   <Pointxyz [x(1), y(1), z(1)]
   <Pointxyz [x(2), y(2), z(2)]
}
print sys(9),ne
if ne = sys(9) then
     message "failed"
else   
     anykey
endif


Determine now the second point of the celected line ,for the end of your arc.
This is the point determined by > Perpendicular To
<Pointxyz [x(2), y(2), z(2)]is the point to finde point 2

Paul
 
« Last Edit: November 28, 2008, 07:42:25 PM by paulerens »

bdeck

  • Hero Member
  • *****
  • Posts: 785
Re: perpendicularto fails if sys(80)>0
« Reply #2 on: November 30, 2008, 03:16:12 AM »
'NE=sys(9)           ' no of entities


Hi paul,

Today, retesting this same code, I cannot duplicate the error.

I'll repost when I get more info.


BD

« Last Edit: December 02, 2008, 04:55:45 PM by bdeck »

bdeck

  • Hero Member
  • *****
  • Posts: 785
Hi Paul, etal,

Here's the problem.

If you set the "SelectOnly" flag in the Extend command using "<selectonly 1", you cannot turn it off in the PerpendicularTo comand using "<selectonly 0".

A hack shown below will fix the bug.

Comment out the hack line, and preselect a line or two to see what happens without the hack.



Code: [Select]
'perp2.d3m, bdeck  11/08,  demo to show bug in SelectOnly parameter

dim x(5), y(5), z(5)
ne=sys(9)        ' no of entities
sys(1) = 0        ' no of points set
sys41=sys(41)            ' archive rubberband type
sys242=sys(242)                  ' archive status of select-when-created flag
sys(41)=0        ' rubberband optional

Setpoint "Set 3 points to draw:    1), 2)  first line, 3) perpline",3

If Sys(1) < 3 Then goto cleanup

for j = 1 to 3                   
  pointval x(j), y(j), z(j), j             
next j

sys(36)=1
sys(242)=1         'turn on select at creation

>line
{
<Pointxyz [x(1), y(1), z(1)]
<Pointxyz [x(2), y(2), z(2)]
}

>Extend
{
<SelectOnly 1                        ' This line turns on the flag 
<Pointxyz [x(2), y(2), z(2)]       
<Pointxyz [x(3), y(3), z(3)]
}

>selectprevious        ' (deselect the extended line)
{
}

>Extend                             ' turn off select only flag                           
{
       <SelectOnly 0         'without this hack, "<SelectOnly 0" below will fail
       <Null
}

sys(242)=0         'turn off select at creation

>PerpendicularTo
{
<SelectOnly 0                     ' This parameter fails
<Pointxyz [x(3), y(3), z(3)]
<Pointxyz [x(1), y(1), z(1)]
}

if sys(9)<ne+2 then
       print "sys(9)",sys(9),"ne",ne
       message "failed"
endif

cleanup:

sys(242)=sys242
sys(1) = 0       
sys(41)=sys41     

end
« Last Edit: December 04, 2008, 05:03:09 PM by bdeck »

paulerens

  • Hero Member
  • *****
  • Posts: 915
Re: perpendicularto fails if sys(80)>0
« Reply #4 on: December 02, 2008, 04:40:30 PM »
Hi bdeck,
The same problem in parallel
you can turn <SelectOnly  on or off in a macro without effect.
The result is that what was indicated last, manually.

bdeck

  • Hero Member
  • *****
  • Posts: 785
Re: PerpendicularTo{ <SelectOnly } fails
« Reply #5 on: December 04, 2008, 03:43:45 AM »
The same problem in parallel
you can turn <SelectOnly  on or off in a macro without effect.

Hi Paul,

Good point.

The Extend command will alter the SelectOnly status for the macro Parallel command also. (tested in v17.2)

I haven't tested any of the other commands.

Another challenge for the indefatigable DT.

BD


« Last Edit: December 04, 2008, 04:25:36 AM by bdeck »

paulerens

  • Hero Member
  • *****
  • Posts: 915
Re: PerpendicularTo{ <SelectOnly } fails
« Reply #6 on: December 04, 2008, 12:53:02 PM »
Hi BD,

Surprising it works!
The parallel <Select Only = 1 also works with your system.

Like coconuts searching with a sheepskin.

Paul