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.

Testing Solid Subtract using BasicCAD

Started by Lar, July 26, 2016, 09:36:56 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Lar

Hi, all.

I'm using Solid Subtract in a macro but I keep getting 'command failed'.

Could some of you guys test it for me?

Below is a simple recorded macro you can use (3D mode, of course). If it fails in the macro then click on the 2 solids (taller one first) to see if it works manually. The macro draws a line where the 2 points for the solid-sub will be set. If you manually click at the same points dcad will ignore the line and register the solids for the solid-sub...

>Box
{
  <Color 0,0,0
  <Layer 1
  <PointXYZ -6.051446751843427e+002,-3.109956933031475e+001,-1.098131788000293e+001
  <PointXYZ -5.912155464061115e+001,-3.821646147076047e+002,4.945666989672909e+002
  }

>FitToWindow
{
  }

>Box
{
  <Color 0,0,0
  <Layer 1
  <PointXYZ -4.600844469742798e+002,2.569036202541221e+002,1.233260180840604e+002
  <PointXYZ -2.041817828506741e+002,-6.701678042920415e+002,3.602593630032276e+002
  }

>FitToWindow
{
  }

>Line   'shows where solid sub points will be set, but dcad will ignore the line and use the solids...
{
  <Color 255,0,0
  <Layer 1
  <LineStyle 0,2.0000,0.0000
  <PointXYZ -5.912155464061115e+001,-3.109956933031475e+001,4.945666989672909e+002
  <PointXYZ -2.041817828506741e+002,2.569036202541221e+002,3.602593630032276e+002
  }

>SolidSubtract
{
  <PointXYZ -2.041817828506741e+002,2.569036202541221e+002,3.602593630032276e+002
  <PointXYZ -5.912155464061115e+001,-3.109956933031475e+001,4.945666989672909e+002
<SelectOnly 0
  }


Thanks,
Lar

Lar

#1
Never mind guys...

I got my macro to work but it seems I had to select the two solids first and then activate 'selected only' in the solid-sub command.

Fyi: The test macro I posted was a normal use of the command and it seems to work ok with 'selected only' deactivated. The actual macro I am writing had to employ a bit of voodoo (a slight tweak of an idea discussed by me and Prl The Great back in August 2013) to make sure the correct solids were used by dcad, but 'selected only' had to enabled to make that voodoo work, it seems. <<note that selecting the correct 2 solids in a macro is subject to the same high-error-probability as just clicking on the 2 solids for the solid sub command, and my voodoo worked for the selection as well as would have worked for the solid sub command... if 'selected only' wasn't necessary>>

Funny thing is, I found some of Prl notes from that discussion (that I had saved on my computer). His voodoo idea is slightly different from mine and works without 'selected only'.

Thanks again guys,
Lar

DrollTroll

*Might* work a bit more reliably if you turn off 2D Select Mode; that way any confusion due to 2D projection shouldn't come into play. Of course, you still have to ensure that your points are each unique to the solid being picked.
25 years with DesignCAD

Lar

I agree DT, because, if I remember correctly, debating 3D select mode is what led to that discussion with Prl (if I ever find the post I'll link it).

The voodoo used here is to let the macro create 2 planes in set positions far off from the drawing, give them the solid id's of the 2 original solids, making them each a part of the solids. Then when ready to solid sub, click on the know points of the 2 planes. Since the planes are so far away there is little chance of clicking on a wrong solid (but the viewing angle is important).

Prl's trick was to create 'improper' planes, ie, 3 point planes but the 2 first points are in the same location. Because of this, dcad deletes the 2 planes during the solid sub. My trick was to create a smaller plane inside of a bigger plane and during the subtraction the bigger plane eliminates the smaller plane and is itself eliminated. My trick is specifically for solid subtract but Prl's is better because it can work for any type of solid operation. Note, however, that Prl's version would only work for the newer versions of dcad that employs 'smart' boolean operations.

Lar

DrollTroll

I don't think you can do the "two consecutive identical points" trick any more -- current versions now filter those out automatically (since about 18 or 19, if I recall correctly).
25 years with DesignCAD

Dr PR

DT,

24.1x64 21-Nov-14

That doesn't apply to curves. You can still set two points at the same place to create a sharp kink in an otherwise smooth curve.

It does apply to lines. If I draw a Line (V) and put two points at the same place the program eliminates the redundant point.

However, if I draw a rectangular Plane (P) and put two points at the same place, Info Box shows five points in the plane.

I haven't checked this in later versions.

Phil



DesignCAD user since 1987

DrollTroll

#6
Yes, curves are the exception because of the necessity to create those sharp bends. For lines and planes, duplicate consecutive points are no longer retained. For your fve-point rectangular plane -- that's normal. First corner, second corner, third corner, forth corner, closing point back at first corner.
25 years with DesignCAD

Dr PR

Right - I forgot about the first and last points at the same position - a sixth extra point at a corner was removed.

Phil
DesignCAD user since 1987

Lar

You are right DT, one of the consecutive identical points gets eliminated.

Luckily, though, the trick still works... maybe because the planes are drawn in a straight line.

Lar