News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Program crash

Started by Dr PR, October 10, 2012, 10:58:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

I have attached a very simple 304 Kbyte file. I have also attached an image - note the selected curve.

If I try to move the third point from the left end of this curve the program crashes. I sometimes get an "Out of Memory" error message. I have never seen this message, even with files of 300 Mbytes.

I select the point (Point Select mode) and try to use Intersect 2 to move the point to the intersection of the selected curve and the red curve it crosses, and crash!

Anyone else have this problem?

Vista 64 SP1
XP Pro SP3

Phil
DesignCAD user since 1987

Adrian 2.0

I get many problems with this file that makes it crash - it seems to relate to zoom distance more than any entities.
I notice the red curve actually has a brown curve (which is grouped with the brown hatch) overlaying it & the hatch boundary also overlays the same curve. If I try to snap onto the curve with any command it crashes - maybe it's confused which entity it is supposed to jump onto?
There is also a problem with the hatch that prevents me zooming in close - the yellow hatch floods the screen before I can zoom enough to see that the two curves don't overlay exactly.

prl

Quote from: adriank on October 11, 2012, 04:45:42 AM
it seems to relate to zoom distance more than any entities.

I agree with adraink, for me the crash occurs if I zoom in and try to select the curved line with the 1267 points. Something is overflowing and it is related to the display. If I zoom out far enough, say fit-to-window, everything is OK. At fit-to-window with one primary screen on a 24" monitor,  I'm at zoom factor 2%.  Zooming in at around zoom factor 500% or so, it will crash DC if I try to select the curve.

I've attached a reduced file that only has the curve.

For reference for Dt & Co & Dempsey the bug tracker.

V15.3 - OK at all zooms
V17.2 - OK at all zooms
V18.3 - OK at all zooms
V19.xx - crashes at zooms somewhere beyond 500%
V22.xx - crashes at zooms somewhere beyond 500%


Rob S

I opened the file in V22, selected the curve at the initial zoom level, and moved the third point from the left with no problem,

Subsequently selected various lines and hatches and moved various points with wild abandon, so far unable to produce a crash.

Tried zooming in to 1200%, and was still able to move the third point.

Using Pavilion DV7 laptop with windows 7 64.
User since forever

DrollTroll

#4
Try using "CurveToLine" in the command line. I don't think you'll have any problems with the curve if converted to a vector.
I'll have Egor take a look and see why it's crashing as a curve.
My suspicion is that as you zoom in, it's using more points to represent each segment of the curve, eventually exceeding the pre-allocated point buffer for that entity.
25 years with DesignCAD

Dr PR

Guys,

Thanks. The curve with a lot of points was produced with the "Parallel by distance" (F2) function - hence the huge number of points. It was supposed to be just temporary so I tried to use it. Normally, after using the parallel function I trace over the many-point parallel line and then delete the original.

I'll just delete the line and start over.

However, it looks like this has flushed out a bug, so the exercise was worth something.

Phil
DesignCAD user since 1987

JJG

Phil,

rather than tracing over the many-point parallel line, use Edit menu>Selection Edit>Smooth Line By Slope Detection, as we talk about hre ( http://forum.designcad.com/index.php?topic=4606.msg28240#msg28240 ) ; that should be what you are needing for : easier and faster to use.

Other way to do it : convert the many-point parallel line to curve, then use the "segit.d3m"-macro from Prl, to have a very good spacing-out points on your segmented line.
;)

prl

#7
I was going to describe how simple it is to code a point reduction routine, but instead of a description, here is the pointless code.  :P  It does one selected line or curve.

It skips points based on the "step".  2 means draw using every other point, 3 - every 3rd point, 4- every 4th point etc.  Keeps the original curve for comparison.  For you coders out there, pretty it up as needed.


'Program: pointless.d3m

dim rx(5000), ry(5000), rz(5000)

if sys(80)=0 then
  Message "Nothing selected. . . routine will end. Press any key to continue"
  END
end if

getselect 1, ent
entity ent

epoints = sys(99)

input "enter destination layer number", destl
input "enter step", nstep

for i = 1 to epoints
    pointval rx(i), ry(i), rz(i), i
next i

>curve
{
   <layer [destl]
   for i = 1 to epoints step nstep
        <pointxyz [rx(i), ry(i), rz(i)]
   next i
}
   
sys(1)=0   
>redraw
{
}

end


Lar

#8
Nice one, Prl.

Quote from: prl on October 12, 2012, 03:23:20 PM
...  For you coders out there, pretty it up as needed.
...Easier said than done.

I started out just wanting to add the option of selecting something (if nothing was originally selected) but ended up with the following...   Please let me know if any particular conditions results in illogical messages or results.

One thing to note is that Prl's version may eliminate the last point and mine does not.

One other thing: the two input boxes has defaults (the layer input defaults to the current layer and the 'skip' input defaults to 1). If using the defaults just click OK without entering anything. Also, Prl's macro asks for a 'step' number and mine asks for an amount to 'skip'. A value of 2 in Prl's is equivalent to 1 in my version.

Lar


'Pointless.d3m
'original by Prl (Dcad Forum member), 12Oct12
'this version revised by Lar, 13Oct12

'NOTE: Do not use on a box with filleted corners because the sides may not be straight anymore. Do each arc separately then Combine.


if sys(80)=0 then

sys(1027)=1    'ok/cancel message box
message "Nothing is selected... Click on an Entity to Select it or click CANCEL to Abort... NOTE: Should not use on a box with filleted corners because the resulting sides may not be straight anymore. Do each arc separately then Combine."
if sys(1028)=2 then end  'if CANCEL is clicked

>PointSelect
{
}

end if

After_ReSel:

getselect 1, ent

entity ent

typee=sys(90)

if sys(90)=1 then typee=1    'if entity is a line (vector)...
if sys(90)=4 then typee=4    'if entity is a curve...
if sys(90)=31 then typee=31  'if entity is a plane...

epoints = sys(99)   'number of points of the entity...

'''''''''message "typee=",typee,", sys(90)=",sys(90)

'if entity is not a line, curve or plane...
if sys(90)<>1 and sys(90)<>4 and sys(90)<>31 then

sys(1027)=4  'message box style = Yes/No
message "Selected entity is Not a Line, Curve or Plane. Do you want to select another entity? (NO will abort macro)"

if sys(1028)=7 then end  'if NO is clicked

if sys(1028)=6 then      'if YES is clicked...
>PointSelect
{
}
goto After_ReSel
end if

end if

'if entity only has 2 points (and is not a curve, see next...
if epoints<3 then
sys(1027)=4  'message box style = Yes/No
message "Selected Entity has only 2 points so macro will do nothing (it does not eliminate the last point). Do you want to select another entity? (NO will abort macro)"

if sys(1028)=7 then end  'if NO is clicked...

if sys(1028)=6 then      'if YES is clicked...
>PointSelect
{
}
goto After_ReSel
end if

end if


'if entity is a curve with only 3 points...
if sys(90)=4 and epoints=3 then
sys(1027)=4  'message box style = Yes/No
message "Selected Entity has only 3 points and is a Curve. A Curve can have no less than 3 points, even if it appears to have 2 (ie, is straight). Do you want to select something else?... (NO will abort macro)"

if sys(1028)=7 then end  'if NO is clicked

if sys(1028)=6 then      'if YES is clicked...
>PointSelect
{
}
goto After_ReSel
end if

'if YES is clicked just continue macro...
end if

dim rx(epoints), ry(epoints), rz(epoints)

destl=sys(3)    'uses the current layer for the default. If using the current layer just click OK, otherwise enter something else...
input "Enter a destination layer <default = the current layer>", destl
if sys(999) then end    'end if CANCEL is clicked...

nstep=2   'this has to be the amount of points to skip + 1 (since using the STEP function, below)...
input "Enter the amount of points to skip <default=1>...", nstepp
if sys(999) then end    'end if CANCEL is clicked...
if nstepp<>0 then nstep=nstepp+1   'if user clicks OK then nstepp would = zero (and be ignored), otherwise use the value+1, since nstep is using the STEP function (below)...

for i = 1 to epoints
    pointval rx(i), ry(i), rz(i), i
next i

if typee=1 then gosub LINEE
if typee=4 then gosub CURVEE
if typee=31 then gosub PLANEE

'RETURNS here...
sys(1)=0   
>redraw
{
}

sys(1027)=0  'message box style = OK (default)
message "-done-"

end

'SUBROUTINES...

LINEE:
>Line
{
   <layer [destl]
   for i = 1 to epoints-1 step nstep
        <pointxyz [rx(i), ry(i), rz(i)]
   next i
<pointxyz [rx(epoints), ry(epoints), rz(epoints)]   'last point...
}
RETURN


CURVEE:
>curve
{
   <layer [destl]
   for i = 1 to epoints step nstep
        <pointxyz [rx(i), ry(i), rz(i)]
   next i
<pointxyz [rx(epoints), ry(epoints), rz(epoints)]   'last point...
}
RETURN


PLANEE:
>Plane
{
   <layer [destl]
   for i = 1 to epoints step nstep
        <pointxyz [rx(i), ry(i), rz(i)]
   next i
<pointxyz [rx(epoints), ry(epoints), rz(epoints)]   'last point...
}
RETURN


prl

Quote from: Lar on October 13, 2012, 09:38:34 AM
...Easier said than done.    I started out just . . .

Funny how BasicCAD pulls you in.  Well done Lar, like the touch about the last point too.