ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getpoint with angle question?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
D_D_K
525 Views, 3 Replies

Getpoint with angle question?

Hi,

From a fixed point (P1) and given angle (ang) then I have Xline XL(but I don't want to create XL).

I want to specify second point P2(by cursor) provided that point P2 belongs to XL.

The desired result is to get these P1,P2 coordinates.

 

Is there any simple way to achieve this by creating an effect to easily select P2? (without using jig,..), 

My idea is use transient (create Xline) to suggest, however how to use osnap P2 with XL?

I want do something similar to polar tracking a given angle (but here nothing to set) or setup rubberband with specify angle (if possible).

 

Thanks in advance!

3 REPLIES 3
Message 2 of 4
tbrammer
in reply to: D_D_K

You could temporary set the UCS x-axis aligned to your desired direction and then set the ORTHOMODE variable to 1.

Enable a rubberband by calling acedGetPoint(P1_ucs, prompt, P2_ucs) with a base point P1_ucs as 1st parameter. Make sure to convert your points to UCS before passing them to acedGetPoint() and back to WCS before you use them.

// Get/Set the UCS
Acad::ErrorStatus acedGetCurrentUCS(AcGeMatrix3d& mat);
Acad::ErrorStatus acedSetCurrentUCS(const AcGeMatrix3d & mat);

// Get/Set the AutoCAD system variable
int acedGetVar (const ACHAR *sym, struct resbuf *result);
int acedSetVar (const ACHAR *sym, const struct resbuf *val);

// Set pt=P1 to enable a rubberband line when selecting P2
int acedGetPoint(const ads_point pt, const ACHAR *prompt, ads_point result);

 

An alternative way would be to insert a temporary XLine, set OSNAP to NEAR and erase the XLine when done.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 3 of 4
norman.yuan
in reply to: D_D_K

While  @tbrammer suggested that you could draw an temporary XLine in order to use OSNAP/NEA, you can easily achieve the almost the same effect if you already has the idea of creating transient XLine for the visual aid: you can just add another small transient rectangle (mimic the OSNAP point) based on the calculation of closest point on the XLine from your mouse point, so that when user clicks for the second point, no matter where the mouse point is, the calculated "OSNAP" point is the point you need.

Norman Yuan

Drive CAD With Code

EESignature

Message 4 of 4
D_D_K
in reply to: D_D_K

Thanks sirs 🗯,

From your suggestions, I have found a solution that suits the my requirements. 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report