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.

Almost brings me to 'tiers'...

Started by minstrel, January 16, 2014, 01:47:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

minstrel

I've a grid broken up into 'tiers' [see attachment]. 

My goal is to make a 'selection' while in 'point select mode' and then select again one or more of the 'tiers' and then 'scale' it, either in or out from center.

Tried isolating the 'resize handle' to the selection(s)...this affected the entire grid.  Tried scale (S)...once again the entire grid was scaled.

Closest I've come to modifying only the selected points [while in point select mode] is with PRL's "psoffset.d3m" macro http://forum.designcad.com/index.php?topic=1328.0.  I've tried to work with it to include 'scale' but, thus far, all efforts remains unfruitful.

Any thoughts and/or solutions?

Rob S

To do it manually, I would draw a temporary new polygon over the points you want to affect, select that new polygon, set a handle at its centre, scale that, and then individually point-move the grid points onto the enlarged polygon points.

Drawing a temporary circle around the existing points makes it easy to set the centre handle

This is harder to explain than to do, so if my brief explanation is not clear, I could upload a step by step drawing.

As to an automatic way, I am not good enough at macros to figure this out right away, and it would certainly be a great feature request for scale and similar commands to operate only on the selected points of an entity.
User since forever

minstrel

Thanks Rob,

I'm good with doing it 'manually' even though the process "Almost brings to tiers... :'( [tears]". Especially knowing there is an easier way [or should be, anyway!].

So, I'm hoping for an 'automated/macro' approach to accomplish this goal.  Unfortunately, my grasp of composing macros is basically at the 'copy/paste' level...very frustratin'!

Dr PR

Minstrel,

Since the entire grid is selected, even if you then select just some of the points any function will probably affect all selected items.

Another way to do what you are trying to do is use the "Extrude Along A Line" function and use the scaling functions in the extrude dialog box. Good luck with that!. I have done it several times and it is extremely confusing, but I have gotten it to work.

It would be easier to do it Rob's way.

Phil
DesignCAD user since 1987

magic

Hi all,

Phil's post made me think, and here is the moving result: http://www.magicsystems.com/Scaled%20extrude.htm

It should bring tears to your eyes.
It's a kind of magic!




minstrel

Quote from: Dr PR on January 16, 2014, 09:01:43 PM
Since the entire grid is selected, even if you then select just some of the points any function will probably affect all selected items.

This is why a 'macro' is required to pull this one off.  PRL's 'psoffset.d3m' macro [see first post] clearly demonstrates that specific points within a selection can, indeed, be manipulated.  Only problem is that the macro, as it stands now, does not allow for a 'from the center' adjustment.

Yes, a scaled 'Extrude Along A Line' works well as does a simple 'profile' sweep...that's not what I'm after.
I seek the ability to manipulate 'specific' points after the initial geometry is drawn.  In other words...sculpt the model 'live' time.


Quote from: magic on January 16, 2014, 11:50:50 PM
... here is the moving result: http://www.magicsystems.com/Scaled%20extrude.htm

It should bring tears to your eyes.

Excellent proof that 'scaled' extrudes can be your friends and are quite easy to perform.  I'm sure your 'clip' will help many reach for the 'tissue' box!

prl

Minstrel,

So you want something that determines the geometric center of the selected points and then offers a scaling fraction to push out (or in) the select points based on a scale factor?  A factor of 1 would keep the points in the original location, a factor of 2 would push them out twice as far from the geometric center, a factor less than 1 reduces the distance to the center etc.


minstrel

Quote from: prl on January 17, 2014, 07:10:25 AM
Minstrel,

So you want something that determines the geometric center of the selected points and then offers a scaling fraction to push out (or in) the select points based on a scale factor? 

Yes, prl. 

I guess it's required to base it on a 'scale' factor to allow for the 'in-out' modifications...although setting by distance would also be convenient as would be a single 'gravity' snap to final destination.

I think there's lots of potential for this sort of design approach/macro...thanks for 'thinking' on it!

prl

Minstrel,  can you post that sample file you have in the first post?  Gives me a starting point for seeing what it would take to do this sort of scaling.

minstrel


Dr PR

#10
Magic,

Excellent illustration of extrusion with scales. The extrude along a curve works this way also.

It is important that you set the points in sequence as you did. The Reference Manual says to set a bunch of points but doesn't say anything about which is point 2, point 3, etc. or what order to set them.

For example, is "point 1" the point you set when you select the object, or is it the point you set to pick the extrusion line? It is the point you set when you select the line, and it MUST be in the proper sequence with all the other points (not stated in the instructions).

The position of the handle on the selected object is VERY important. In your example the center of the "circle" just happens to be the selection handle, and it is also the "first" point on the line, so things work as expected. But if the primary selection handle is not at the first point on the line the results can be weird.

Phil
DesignCAD user since 1987

prl

Quote from: minstrel on January 17, 2014, 08:18:01 AM
I think there's lots of potential for this sort of design approach/macro...thanks for 'thinking' on it!

Minstrel,

Well here is a basiccad program that will let you set the distance from the averaged center of the selected points.  Also I've attached one of my super 8 movies for you in the zip file which demos the basiccad routine using your original file.

For lack of giving this sort of program a name, per my convention I simply called it mtpm.d3m.  Change it to suit your naming needs.

'Program: mtpm.d3m (minstrel tier point mover v1)
'
' v17.1 + and requires point select mode with points already lassoed

' 1/25/2014 - v1 per Minstrel request, averages lassoed points and computes a new location for the point based on distance.

dim jx(100), jy(100), jz(100), rx(100), ry(100), rz(100)

if sys(345) = 0 then
   message "You need to be in point select mode with points selected.  Program will end."
   sys(80)=0
   End
endif

setselectedpoints
count = sys(1)

if count = 0 then
   message "No points selected.  Program will end."
   sys(80)=0
   End
endif

'message count

xtot = 0
ytot = 0
ztot = 0

'record initial lassoed points
for j = 1 to count
  pointval jx(j), jy(j), jz(j), j
next j

gosub checkpoints

for j = 1 to count
  xtot = xtot + rx(j)
  ytot = ytot + ry(j)
  ztot = ztot + rz(j)
next j

xc = xtot/count
yc = ytot/count
zc = ztot/count

dx = rx(1) - xc
dy = ry(1) - yc
dz = rz(1) - zc
d = dx * dx + dy * dy + dz * dz
d = sqrt(d)

message "current selected points average radius = ", d

input "enter new radius: ", rz$

for j = 1 to count
  ex2 = rx(j)
  ey2 = ry(j)
  ez2 = rz(j)
  gosub unitvector
next j

sys(1) = 0

End

'subroutines follow

checkpoints:
  'look for duplicate coordinates and remove them
  'do a forward pass
  'message "checking for duplicate points"
  newcount = 0
  for i = 1 to count
    dupflag = 0
    for j = i + 1 to count
      if abs(jx(i)-jx(j))<.001 and abs(jy(i)-jy(j))<.001 and abs(jz(i)-jz(j))<.001 then
        dupflag = 1
        'Message "duplicate found" , i , j
        exit for
      endif
    next j
   
    if dupflag <> 1 then 'add
      newcount = newcount + 1
      rx(newcount) = jx(i)
      ry(newcount) = jy(i)
      rz(newcount) = jz(i)
    endif
  next i
  count = newcount
  'message "new count is", count   
return   

 
unitvector:
  sys(1)=0
  dx = ex2 - xc
  dy = ey2 - yc
  dz = ez2 - zc
  d = dx * dx + dy * dy + dz * dz
 
  if d = 0 then
    message "error: 1st and 2nd points are identical, unable to determine unit direction vector."
    end
  end if
 
  d = sqrt(d)
 
'unit vector
  di=dx/d
  dj=dy/d
  dk=dz/d
 
  if rz$="" then input "enter magnitude (length) of the line: ", rz$
  r=val(rz$)
 
  if r < 0 then r = 0
 
  'direction vector components
  rx = r*di
  ry = r*dj
  rz = r*dk
 
  x2 = xc + rx
  y2 = yc + ry
  z2 = zc + rz
 
  >pointmove
    {
      <pointxyz [ex2, ey2, ez2]
      <pointxyz [x2, y2, z2]
    }
 
  >redraw
   {
   }
return

minstrel

#12
Now, look at that! ..."ask and it will be given to you!", Thanks prl!

This [macro], without question, is a work of art...and once again breaths even greater potential into DCAD and it's capabilities!

Thanks again for your 'gift' to me and the community.  Now I'm off to play ;)

ps - I just this past week got your 'PSPad' OLE to work together with DCAD - ...thanks again to both you and Dempsey for that inspiration.  Perhaps now I can begin to grasp all this BasicCAD stuff!

edit - pps
Let the sculpting begin! [using original 'super8' file]...attached initial results which quickly show the advantages of this 'macro' over a typical 'scale' or 'manual' approach.  Sure, this example only uses a few points, but consider a much more complex model...and it's instantaneous!!!  Great prl!

prl

Quote from: minstrel on January 26, 2014, 12:09:20 AM
ps - I just this past week got your 'PSPad' OLE to work together with DCAD - ...thanks again to both you and Dempsey for that inspiration.

Minstrel, glad you like it.

Regarding PsPad, an added benefit is if you link the DesignCAD Macros17.hlp to the PSPad editor, you can look up basiccad commands while in the PsPad editor by placing the cursor on a keyword and hitting Alt F1.

In Dempsey's excellent pdf step by step instructions, on his page 2 instructions, add the location for the Macros17.HLP file.  See attached graphics below. Note the help file location. Yours may be different but you get the point.  Makes programming a bit more enjoyable.

minstrel

Quote from: prl on January 26, 2014, 04:56:58 AM
Makes programming a bit more enjoyable.

Hope so, anyway!  Thanks for the extra tip.  I had already set the Macro17.hlp to an icon/toolbox...but, this is even better!