Getting An Input Arc

Getting An Input Arc

Kyudos
Advisor Advisor
796 Views
9 Replies
Message 1 of 10

Getting An Input Arc

Kyudos
Advisor
Advisor

For certain creation modes of my custom object I need a user-input arc or circle. Ideally I'd like to see these as they are being input by the user. My first thought was to just use the CIRCLE and ARC;C commands. However, the default AutoCAD three point arc (center, start and end) does not draw intuitively - it always draws CCW - not in the direction you move your mouse (I do appreciate the Ctrl modifier here - it just seems a little clunky to use).

 

So if I want it to work "better", I'll have to roll  my  own I guess. I'm pretty certain that the answer is a jig - but is it worth exploring anything else? - e.g., 3 x acedGetPoint + transient graphics?

0 Likes
797 Views
9 Replies
Replies (9)
Message 2 of 10

daniel_cadext
Advisor
Advisor

Yeah, I would use a Jig, maybe a Jig derived from AcDbEntity where I would use worlddraw to draw a circularArc

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 3 of 10

tbrammer
Advisor
Advisor

I agree to Daniel. It's not so hard to roll your own jig.

Have a look at the sample project in <ARX>\samples\database\elipsjig_dg


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

0 Likes
Message 4 of 10

Kyudos
Advisor
Advisor

So I quickly created the attached jig. It works fine in the "place a circle" and "draw a circle" modes. I have a fake polyline arc that also jigs correctly (i.e., with the correct points).

 

But for the life of me, I can't seem to get it to draw an ordinary arc based on my three points. I've messed with with AcDbArc and AcGeCircArc3d - but nothing ever seems to draw? The closest I got was adding a bulge to the centre segment of my polyline arc, but that is insufficient without some complex adding of extra points, since I need it to be able to be > 180°. What am I missing?

0 Likes
Message 5 of 10

daniel_cadext
Advisor
Advisor

This is what I had in mind for a draw jig,  just draw the primitives instead of creating entities

the command is doit

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 6 of 10

daniel_cadext
Advisor
Advisor

then, say you want the opposite arc, you can do something like 

 

Adesk::Boolean AEI_ArcCircleJig::subWorldDraw(AcGiWorldDraw* pWd)
{
    auto& geo = pWd->geometry();
    auto& traits = pWd->subEntityTraits();

    //circle
    //traits.setColor(1);
    //geo.circle(_c, _b, _a);

    //arc
    traits.setColor(4);
    geo.circularArc(_a, _b, _c);

    //opp arc
    traits.setColor(2);
    AcGePoint3d _d = _b;
    AcGeCircArc3d carc(_a, _b, _c);
    _d += (carc.center() - _b) * 2;
    geo.circularArc(_a, _d, _c);

    return Adesk::kTrue;
}

 

arc.png

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 7 of 10

Kyudos
Advisor
Advisor

Thanks for the example, it is good to know there are other ways. However, I think I might have to revert to the AutoCAD ARC;C command. A jig is a lot of code to write to replicate something I can do it two lines of code in my current code base - especially when you factor in the dynamic dimensions etc. I feel like AutoDesk are missing a trick in not providing basic jig classes. I can't be the only ARX developer who has seen e.g. the simple line or arc jigging already available and thought "I just want that - I see it is already there"....but no, you have to rebuild it from scratch...

0 Likes
Message 8 of 10

tbrammer
Advisor
Advisor

I understand what you say. It is always the same story: Either an API is too complex or it doesn't offer enough flexibility. At the end it is your choice: I you are fine with the existing commands like ARC or PLINE you are free to use them with acedCommandS(). But you have to live with a lack of flexibility and control. That's the main reason for me to prefer AcEdJig over acedCommandS(). If you want to have a functionality taylored to your needs you have spend some time and deal with the API. 

My personal opinion is that the AcEdJig class is easy enough to handle. Dynamic dimensions is another story. I scratched my head many times trying to make them work. There are definitely not enough examples and documentation about it.


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

0 Likes
Message 9 of 10

Kyudos
Advisor
Advisor

@tbrammer I already implemented some dynamic dimensions on one of my other custom objects, so I assume (haha!) it would translate similarly to jigs - but as I say a lot of work to replicate something that clearly already exists!

 

In this instance, I decided not to abandon my jig! 🙂 In the arc case, I think I was messing up the angle calculations. But since this is already taking too much time, I just modified my polyline 'arc' jig to insert some arc-ish points between my start and end.

0 Likes
Message 10 of 10

Kyudos
Advisor
Advisor

So I got my jig going with dynamic dimensions, but in some places my editable radial dimension has a weird non-editable ghost value (see below). Anyone have any ideas where that comes from?

 

DimBug.png

0 Likes