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.

PointRelative (and PointPolar) arguments

Started by Bob P, April 20, 2013, 04:08:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bob P

I'd like to create a command-line macro that eliminated the dialog box (I hate 'em...), but can't find any information on the options. For instance, I'd like to have something like this so that I can insert command line values without worrying about the current state of setting the point:

>pointrelative
{
<lastcursorposition (or reference point, etc)
}

Recording a macro comes up with nothing relevant...

prl

#1
Hi Bob,

Use the command line directly:

examples

pointrelative 5'4"  (this is equivalent to 5'4,0,0)

or

pointrelative ,5'4"       (note the first ,  this is equal to 0,5'4",0)

or

pointrelative ,,5'4"  (this is equivalent to  0,0,5'4")

If you like this approach, edit your custom.ini file and add a shortened version

say

pr ,,5'4"

Bob P

PRL,

My "point" is the problem with the equivalent to being able to choose one of the point-relative options from within an argument inside the macro.  i.e. Have a macro that automatically chooses the "from reference point" option (or one of the others) so that I can write separate macros for each option.

prl

Quote from: Bob P on April 20, 2013, 06:07:18 AM
My "point" is the problem with the equivalent to being able to choose one of the point-relative options from within an argument inside the macro.  i.e. Have a macro that automatically chooses the "from reference point" option (or one of the others) so that I can write separate macros for each option.

I'm missing what you are actually trying to do.

As far as I know, 

>PointRelative
{
}


in this form doesn't exist as Command.


It does exist for drawing commands as a parameter to set points, example

>SomeDesignCADCommand
{
<PointRel [x, y, z]
.
.
.
}



Bob P

Since pointrelative exists as a valid command-line command, I was hoping that some similar syntax could be used as a standard command in a macro.  That appears not to be the case.  That means that none of the dialog-box options are available in a macro, only "From last point".

Oh well...

Dempsey

Bob P,

I am not really clear on what else you are looking for. As prl already mentioned there are many specials like:
<pointxyz
<pointrel
<pointpolar
etc.

for use as arguments (parameters) for DesignCAD commands within macros.  For example the Move command allows you to specify "from handle" or "from reference point"; in other words commands have dialogue settings as part of the command for use in the macro.

If you haven't yet done so then I recommend that you download macros17.zip from http://forum.designcad.com/index.php?topic=1537.0 and look at chapter 3 of the help file. Granted, a few commands have gotten additional/altered parameters since version 17 (often published in the release notes for each version), but it is the latest macro documentation we have.

Dempsey

Bob P

Quote from: Dempsey on April 20, 2013, 12:34:44 PM
Bob P,

I am not really clear on what else you are looking for. As prl already mentioned there are many specials like:

Draw a line.
Open the pointrelative dialog box with the ' key.  See all the options (that are not available directly through arguments):

Relative to
1/ Last Cursor Position
2/ Origin
3/ Reference point
4/ Last point

Move cursor without setting point
Always reset values to zero

Dr PR

What Bob P wants to do is select one of the options that are available from the dialog box in a macro. For example, "Reference Point."

Phil
DesignCAD user since 1987

prl

#8
Quote from: Dr PR on April 20, 2013, 08:27:20 PM
What Bob P wants to do is select one of the options that are available from the dialog box in a macro. For example, "Reference Point."

If BobP wants to merely use basiccad to preset some of the options on the dialog without having to see the dialog, but still use it normally (not within a basiccad program), then that unfortunately isn't available.

Keep in mind, the point relative command is now a swiss army-knife overloaded function type command.  You can do all those things (the various options in the dialog) using the original single purpose standard commands.  Example, the point relative command relative to the origin is simply the normal set point command.  The "reference point" is a combo of a temporary origin shift with the normal set point command, etc. 

Personally I don't like some of these overloaded functions (similar to the rotate command), they muddy the waters.

bdeck

#9
BobP,

I feel your pain.  This was a subject of a feature request some time back.

My biggest problem with point relative is that I use mostly the Last Point option, but that is not available for moving points in point select mode. After using the Reference Point option, I sometimes forget to set the option back to Last Point, and bad things happen.

So I have a macro just for doing point moves. Now I do not have to remember to reset the Last Point option the next time I use the Point Relative dialog after a point move.

BD


'MPR.d3m   BDeck  4/23/2013
'
'Macro to move selected points a relative distance
'without using the point relative command
'
'Drag select some points and run the macro.
'DO NOT SET A STARTING POINT

gosub OptionalTest

input "x offset", x$
input "y offset", y$
x=val(x$)
y=val(y$)
z=0
if sys(344)=0 then
input "z offset", z$
z=val(z$)
endif

>DragMoveSelectedPoints
{
<Pointxyz 0,0,0
<Pointxyz [x, y, z]
}
end

OptionalTest:
if sys(345)=0 then
message "not in point select mode"
end
endif
sys(1)=0
setselectedpoints       
n=sys(1)   ' no of points in point buffer
        sys(1)=0
if n=0 then
message "no points selected"
end
endif
return


Edited 4/15 to add val(function) per comment below.

Dempsey

bdeck,

I played around a bit and was wondering if this code gives you any new ideas:
INCLUDE "DcadAlias.d3i"
Message "Example point set followed by line to relative point"
SetPoint "Set one point...", 1
>Line
{
<UsePresetPoints
<Pointrel 10, 5, 20
}
end
Dempsey

bdeck

Hi Dempsey,

Yes, your code appears very useful, even if only for drawing construction lines, which could be used to locate points for any type of entity.


'cc.d3m
'draw a  construction line using cartesian offsets

SetPoint "Set start point point...", 1
input "enter x offset of second point", x
input "enter y offset of second point", y
z=0
if sys(344)=0 then
input "enter z offset of second point", z
endif
>Line
{
<UsePresetPoints
<Pointrel [x, y, z]
'  <incomplete    'optional
}
end



BD





prl

#12
Quote from: bdeck on April 23, 2013, 05:15:30 AM
So I have a macro just for doing point moves. Now I do not have to remember to reset the Last Point option the next time I use the Point Relative dialog after a point move.

Bdeck, I like it.  I fiddled with it for my purposes, a single input line.

'MPR2.d3m   BDeck  4/23/2013

'Macro to move selected points a relative distance
'without using the point relative command

'Drag select some points and run the macro.
'DO NOT SET A STARTING POINT

' prl variation
'4/24/2013 - tweaked Bdeck version for single input line or single command line

'example single line inputs: (directly from command line or single input dialog)
'   mpr2  5'4",3'2",2'4"
'   mpr2  ,,2'4"   (this is same as 0,0,2'4")
'   mpr2  ,3'2"    (this is same as 0,3'2",0)


gosub OptionalTest

a$=sys$(0)
precision 15
if a$="" then Input "Enter relative x,y,z:", a$

'begin parse routine for individual x,y,z offsets
dim f$(3)
f$(1)="0"
f$(2)="0"
f$(3)="0"

for j=1 to 2
    x=INSTR(a$,",")
    if x=0 then exit for
    tl=len(a$)
    f$(j)=left$(a$, x-1)
    if f$(j)="" then f$(j)="0"
    a$=right$(a$,tl-x)
next j
f$(j)=a$
'end parse routine for individual x,y,z offsets


x=0
y=0
z=0
x=x+val(f$(1))
y=y+val(f$(2))
z=z+val(f$(3))


>DragMoveSelectedPoints
{
<Pointxyz 0,0,0
<Pointxyz [x, y, z]
}
end

OptionalTest:
   if sys(345)=0 then
      message "not in point select mode"
      end
   endif
   sys(1)=0
   setselectedpoints       
   n=sys(1)   ' no of points in point buffer
        sys(1)=0
   if n=0 then
      message "no points selected"
      end
   endif
return

bdeck

#13
Prl,

Cool. I had forgotten the val function could do that. I should read the SDK more often. It even scales feet and inches correctly when drawing units are set to meters.

I added one line to your code for those of us who sometimes work in the dark and have trouble finding the comma key.

for j=1 to 2
    x=INSTR(a$,",") ' check for comma delimiter
    if x=0 then x=INSTR(a$," ")  ' check for space delimiter
    if x=0 then exit for
    tl=len(a$)
    f$(j)=left$(a$, x-1)
    if f$(j)="" then f$(j)="0"
    a$=right$(a$,tl-x)
next j


All,

Is there any way to run a macro in the middle of a drawing command?

BD

prl

Quote from: bdeck on April 25, 2013, 07:09:32 AM
I had forgotten the val function could do that.

Bd, the val() command is semi-intelligent though know its behavior.  It needs the inch symbol when doing feet and inches.

example:

5'4" is evaluated correctly (5'-4").
5'4 is evaluated incorrectly (it is evaluated as 5'-0").