Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

GetPoint ou GetDistance

O_Eckmann
Mentor

GetPoint ou GetDistance

O_Eckmann
Mentor
Mentor

Hi,

 

I try to insert a block by clicking 3 points to obtain rotation, XScale and YScale. But with the third point I recalculate height of my rectangle

O_Eckmann_0-1704707189450.png

 

So for third point I use GetPoint, but I'd like user can directly enter the height of rectangle.

If user enter a numeric value, it is used to recreate point 3 in the direction of my mouse.

O_Eckmann_1-1704707269615.png

I could use a keyword to switch to Getdistance mode, or perhaps with an inputpointmonitor, but is there a simple solution to know if a point is clicked or if a value is enter at GetPoint request?

 

Thanks

 

Olivier

Olivier Eckmann

EESignature

0 Likes
Reply
Accepted solutions (1)
383 Views
6 Replies
Replies (6)

cuongtk2
Advocate
Advocate

Type a double value in Getpoint prompt.

0 Likes

_gile
Mentor
Mentor

Hi,

Try this way:

double height = new Line3d(pt1, pt2).DistanceTo(pt3);


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes

O_Eckmann
Mentor
Mentor

Hi @cuongtk2 ,

 

Sorry, but I don't understand your answer. I can enter an integer or a real value, it's always used as a distance to recalculate a point form my basepoint in the direction of my mouse.

I've made a screencast of my behaviour. The goal is to mimic Distance option by just knowing if user has clicked a point or has entered a value.

 

Thanks

Olivier Eckmann

EESignature

0 Likes

O_Eckmann
Mentor
Mentor

Hi @_gile ,

 

Thanks for your method, but my problem isn't to calculate the perpendicular distance from point 3 to segment 1-2, but to know if user has picked a point or has entered a value when GetPoint ask to click a point (form my base point).

Olivier Eckmann

EESignature

0 Likes

norman.yuan
Mentor
Mentor
Accepted solution

I assuming what you are asking is how to allow you either select a point, or enter a number during GetPoint() call without having to force user to choose a keyword to switch to GetDistance(). 

 

You can set AllowArtibaryInput property of PromptPointOptions to true. Then when testing PromptStatus to be either OK for point clicking, or Other for whatever user entered value. You, of course need to test whether the entered value is a valid numeric value: if the value is invalid, you may want to loop back to rerun the GetPoint() call.

 

You can do the same by calling GetDistance(), instead of GetPoint(). That is the arbitary value input must be a valid point input.

 

Norman Yuan

Drive CAD With Code

EESignature

O_Eckmann
Mentor
Mentor

Hi @norman.yuan ,

 

That's what I want. 

I've already tested this solution, but I hadn't seen that the status was keyword. I thought it was OK.

 

Thanks a lot.

Olivier Eckmann

EESignature

0 Likes