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.

limit points in combine lines

Started by bdeck, February 11, 2013, 10:23:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bdeck

When filleted lines are combined using combine lines, the fillet arcs are first converted to vectors. The large  number of points in the conversion leads to excessively complex cnc files for my purposes.

Is there any way to limit the number of points in the fillet vectors? Point reduction after combining lines is not an option.

Going back over a drawing with hundreds of fillets and converting them individually is a pain.

Alternatively, if the fillet command could have an option to draw as lines so that it could be controlled by sys(269), that would probably be a workable solution.

BD

prl

Bdeck,

You can massage the segit.d3m code.  http://forum.designcad.com/index.php?topic=4606.msg28241;topicseen#msg28241

Cycle your drawing looking for arcs, subroutine to the relevant portions of the segit code.  You do this before you combine.

prl

#2
Bdeck,

Here is a very quick adaption.  Note it will NOT save your original arc fillets, so use on a drawing copy.


'program: bdfill.d3m (bdeck fillet replacement)

dim px(1000), py(1000), pz(1000)

sys(242) = 0  'select object when created OFF - depending on how you work you may want to store and restore the value at the program end

ndiv = 6 'number of segment for each fillet, change as you wish

cl = sys(3) 'current layer

count = 0
for i = 1 to sys(9)
    entity i
    if sys(90) = 16 then 'circular arc, add to list
       count = count + 1
       pointval px(count), py(count), pz(count), 1
    endif
    sys(1)=0
next i
sys(1)=0

sys(36)=2
for i = 1 to count
  start = sys(9)
  >PointSelect
  {   
    <Type 0
    <pointxyz [px(i), py(i), pz(i)]
  }
  >segment
  {
  <segment [ndiv]
  <setpointanddirection 0
  <pointxyz [px(i), py(i), pz(i)]
  }
 
  gosub SelectNew
  'erase the original segmented entity
   >erase
  {
  }
 
  sys(80)=0
  sys(1)=0
next i

sys(36)=0
sys(3)=cl
regen
Message "Finished"
End

'subroutines follow
SelectNew:
  sp1 = start
  >line
  {
  for j = sp1 to sys(9) 
    entity j
   
   'circle or circular arc, get second and third points
    pointval ptX1, ptY1, ptZ1, 2
    pointval ptX2, ptY2, ptZ2, 3 
     
    'now draw two point line
    <pointxyz [ptX1,ptY1,ptZ1]
    <pointxyz [ptX2,ptY2,ptZ2]
   
    getattr j, type
    putattr j, type, 1
  next j
  }
Return



Lar

Quote from: bdeck on February 11, 2013, 10:23:01 AM
Is there any way to limit the number of points in the fillet vectors? Point reduction after combining lines is not an option.
BD, one quick way of doing this is to select all your arcs (using the 'selection filter', before 'combining'), 'vector convert', then use 'smooth line by point reduction/ slope detection'. I normally use the default 'number of points' factor of 5, with 'convert to curve' deactivated (otherwise you would still end up with a bunch of points when you combine). Then I select all the straight lines and vector-arcs and 'combine'. Dcad does a good job of deciding which pieces of lines should be connected together, long as their end points meet (which fillet will ensure). I have my 'vector convert' and 'smooth line' buttons side by side in a custom toolbox.

In a recent post the fact that 'number of points' is a factor and not an absolute value was frowned upon but using the command on multiple arcs at once demonstrates the value of it being a factor, ie, you don't end up with different size vector-arcs all of the same number of points.

Lar

magic

Hi all,

Usually, and certainly in ContourCAM, you don't need to combine lines. Actually sometimes two point lines are preferred.

And CAM programs will usually "read" both arcs and vectors.
It's a kind of magic!




bdeck

#5
Prl,

Cool macro with some clever tricks.  Many Thanks. 

I added a few lines to allow the macro to ignore circles.  Didn't know about the segment command, or that it would work on arcs. Go figure.

Lar,

Your method would have been my next step, perhaps with a macro to select only arcs that share a point with another entity. Thanks.

Magic,

I use the term "cnc" rather loosely.  This a cut path for an automated knife. It is generally easier for me to generate the entire nested cut file in DC than to use the vendor software for the last half of the operation. That way I don't have to change chairs.  8)

bd


Lar

Quote from: bdeck on February 11, 2013, 07:19:47 PM
Lar,
Your method would have been my next step, perhaps with a macro to select only arcs that share a point with another entity. Thanks.
Knowing that I would want filleted arcs to be combined with the straight lines I would create them in such a way that they (along with the straight lines) are easy to isolate with the Selection Filter, either using color or layer, or both. I would also vector and combine them as they are created, as opposed to waiting until the file is completed (my files use hundreds of layers).

Lar