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.

Problem getting points for entity

Started by MarkX, October 16, 2011, 04:46:14 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

MarkX

I have some starter code, but have already hit a wall. I'm trying to grab the positions of points on a polygon, but the points the program thinks it has are different than the actual points of the polygon. I've made this more clear by putting pointmarks at each of the positions where the program thinks the polygon is. The pointmarks form an identical polygon, translated some distance away from the true position. I've tried this both moving and not moving the polygon before grabbing the points, but either way the wrong points seem to be socked away.

So, what's going on?

Code and drawing attached. In drawing, run the macro specifying first the new origin on the lower plane and then a corner of the polygon floating above. Ignore the cylinder in between.

Thanks!
Mark

dcadRob

Since you are not getting any responses...

Would tell us what you are trying to achieve and why? Maybe there is a better way of doing it.

Lar

MarkX,

I tried the macro on the file and it seems to work ok, from what I understood of your description (though I'm not sure where the angle or length is measured from).

The attached file shows the results. Note that your pointmarks do not line up with the moved plane. I now recall that on my first attempt where I set the first point at the original 0,0,0 (the left most point of the lower plane when the file opens) your pointmarks did line up with the moved plane.

MarkX

Quote from: Lar on October 19, 2011, 09:02:22 AM
MarkX,

I tried the macro on the file and it seems to work ok, from what I understood of your description (though I'm not sure where the angle or length is measured from).

The attached file shows the results. Note that your pointmarks do not line up with the moved plane. I now recall that on my first attempt where I set the first point at the original 0,0,0 (the left most point of the lower plane when the file opens) your pointmarks did line up with the moved plane.
Hi Lar,

Thanks for replying.

The problem is that the four pointmarks are SUPPOSED to be on the corners of the moved plane. The points are determined after the move (or after no move if I skip that step) with the same identity number. SO, they should be on the corners of the polygon. Instead, they are translated out into space. I haven't applied any sort of process that should shift them.

You can skip the angle measurements if you want, because they are meaningless if the pointmarks are wrong.

I guess what this is saying is that the points that are returned are in the original WCS and not in the working UCS. Which I would consider a bug or at least a severe nuisance. Why have the user set the initial starting point, and then not incorporate that into all future measurements? Its the first thing the macro recorder records if you run the recorder.

The ultimate goal is to be able to place a polygon on a specified workplane. Maybe then knock a few steps off the unfolding process outlined by you or Dr Phil.

Thanks!
Mark



DrollTroll

The problem is your use of SetStartPoint.

SetStartPoint will temporarily modify the origin used when you set or obtain points via macro commands or statements, but NOT modify the locations of points obtained via the Entity statement (not sure about points obtained by QUERY -- I'll have to check on that). It works well for simplistic macros where you just want to draw simple objects at specific offsets from some user-supplied point rather than calculating the offsets manually or using PointRelative, but where you're mixing in existing points of objects via ENTITY and POINTVAL, it's not so great a choice.

In your case, rather than using SetStartPoint, try using the SETPOINT statement instead, and storing the point's coordinates set via POINTVAL, i.e.


'Have the user set a destinatinon point

SetPoint "Set a point for the destination", 1
PointVal x0, y0, z0, 1


Then when you are using the Move command, move to [x0, y0, z0], not [0, 0, 0].

My modified macro attached...
25 years with DesignCAD

Lar

Quote from: MarkX on October 19, 2011, 09:23:40 AM
...
The problem is that the four pointmarks are SUPPOSED to be on the corners of the moved plane. ...

Sorry, Mark, somehow I did not comprehend that from your first post but now I see that's exactly what you said.

My thing was: if the polygon moved where it was supposed go and the message at the end displayed the correct first point, then why bother with the pointmarks.

Your use of 'setstartpoint' was nagging me because I hardly ever use it... since it does not jump out at you to set it when you run such a macro later (the message in the status bar should flash red or something. I always but a message before a setpoint so the user can't help but see it) and I see from DT's solution that it was the issue.

Well, problem1 solved. On to problems2, 3 and beyond.

Lar