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.

Getting SetHandle to work

Started by MarkX, March 12, 2012, 09:53:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

MarkX

Hello,

I'm trying to use the SetHandle command. Something like:

>SetHandle
{
<Pointxyz points_1x(gnCurEntity), points_1y(gnCurEntity), points_1z(gnCurEntity)
}


The object has already been selected before this is called.

Every time it gives me a designcad error with # 10166. No clue what that means, of course. I've tried several variations on this.

Anyone gotten this to work?
Thanks!
Mark

JJG

MarkX,

here    http://forum.designcad.com/index.php?topic=3103.0   are some code working the same way you are looking for.

paulerens

#2
Hi Mark,
This macro places a handle on the first point of an entity.

If Sys(80) < 1 Then
Message "There is no object selected.Select an object."
>PointSelect
{
<CmdPrompt "Select an entity ."
}
End If
GetSelect 1,j
Entity j
PointVal x1 ,y1 ,z1 ,1
>SetHandle
{
<Pointxyz [x1 ,y1 ,z1 ,1]
}
End

Bob P

Note that values sent to commands must be within brackets. (Some of the early documentation was wrong.)
i.e.
<pointxyz [x,y,z]

MarkX

Hi everyone,

The complication I have is that the point at which I'm trying to set the handle is shared with another object. Basically I have planes that touch at their edges and points. This seems to prevent me from being able to set the handle. Not quite fair, since you can do this by hand inside of DesignCad.

If I create space between the planes, then the code will work ... but I really wanted to set the handles just like I could by hand.

Thanks!
Mark

MarkX

Ok. Try this. Create a blank document and add just one plane to it.
Now run the code below where I've hard-coded for entity #1.

You will get (I think) the error I've been getting. It seems like DC treats objects that you select by hand differently than objects that you have selected by CHANGE.

Ideas?

Thanks!
Mark


'Uncomment this if you wish to verify Entity #1 exists
'FOR i = 1 TO SYS(9)
'MESSAGE i
'NEXT
Alias ENT_SELECTED            &H010C  'R/W - b

ENTITY 1
CHANGE ENT_SELECTED, 1
REGEN
PointVal x1 ,y1 ,z1 ,1
>SetHandle
{
<Pointxyz [x1 ,y1 ,z1 ]
}
End


paulerens

#6
DC always selects the oldest entity. = Smallest entity number.
In my macros I do, the following.
Select the entity, if I disagree I repeated select.
The macro does <SELECT> Erase> Undo>
By Erase and Undo, the oldest(and selected) entity become the youngest entity = largest number.
And then the new oldest number is now selected.

dcadRob

You need UPDATE after CHANGE. You also don't have INCLUDE *\DcadAlias.d3i which is easier to read than making your own alias.

MarkX

Quote from: paulerens on March 13, 2012, 11:01:00 AM
DC always selects the oldest entity. = Smallest entity number.
In my macros I do, the following.
Select the entity, if I disagree I repeated select.
The macro does <SELECT> Erase> Undo>
By Erase and Undo, the oldest(and selected) entity become the youngest entity = largest number.
And then the new oldest number is now selected.
Hi Paul,

I'll have to remember that trick for future reference. For my current project, I need to add entities to the current selection as I work, so I think accessing each item by entity # will give the greatest control.

Thanks!
Mark

MarkX

Quote from: dcadRob on March 13, 2012, 11:20:34 AM
You need UPDATE after CHANGE. You also don't have INCLUDE *\DcadAlias.d3i which is easier to read than making your own alias.
Hi Rob,

Whoa -- another "secret handshake" command. I've spent hours going through the macro reference, and nothing hinted that I would need UPDATE after changing an attribute.

But that seems to be the ticket ... at the moment ;-)

Thanks!
Mark

paulerens

#10
Mark,
I wonder how you're going to find the (Entity #) = (Entity by ID), because the ID is a number.

MarkX

Quote from: paulerens on March 13, 2012, 03:43:35 PM
Mark,
I wonder how you're going to find the (Entity #) = (Entity by ID), because the ID is a number.
Hi Paul,

You iterate through the entities and collect a list of those that match the criteria that you want. Then you iterate through the list of entities and perform your operations.

Thanks,
Mark