Author Topic: Autocad Jig Sampler Function C#  (Read 3182 times)

0 Members and 1 Guest are viewing this topic.

dawido000

  • Guest
Autocad Jig Sampler Function C#
« on: July 22, 2014, 02:47:14 PM »
Is there any way to get from user both Point3d or String value in EntityJig object? I would like to reach such effect as in attachment?

I tried something like here:
Code: [Select]
protected override SamplerStatus Sampler(JigPrompts prompts)
        {
                        JigPromptStringOptions prOptions3 = new JigPromptStringOptions();
                        JigPromptPointOptions prOptions2 = new JigPromptPointOptions("\n");
                        prOptions2.Keywords.Add("Koniec");
                        prOptions2.Keywords.Add("Zamień");
                        prOptions2.Keywords.Default = "Zamień";
                        prOptions2.BasePoint = mPunkt1Biezacy;
                        prOptions2.UseBasePoint = true;

                        prOptions2.UserInputControls =
                            UserInputControls.Accept3dCoordinates |
                            UserInputControls.AcceptOtherInputString |
                            UserInputControls.GovernedByOrthoMode |
                            UserInputControls.GovernedByUCSDetect |
                            UserInputControls.UseBasePointElevation |
                            UserInputControls.AnyBlankTerminatesInput |
                            UserInputControls.InitialBlankTerminatesInput |
                            UserInputControls.NullResponseAccepted;
                        prOptions3.UserInputControls =
                            UserInputControls.Accept3dCoordinates |
                            UserInputControls.GovernedByOrthoMode |
                            UserInputControls.GovernedByUCSDetect |
                            UserInputControls.UseBasePointElevation |
                            UserInputControls.AnyBlankTerminatesInput |
                            UserInputControls.InitialBlankTerminatesInput |
                            UserInputControls.NullResponseAccepted;

                        PromptResult prResult3 = prompts.AcquireString(prOptions3);
                        PromptPointResult prResult2 = prompts.AcquirePoint(prOptions2);
                       
                       
                        if (prResult3.Status == PromptStatus.OK)
                        {
                            strTekst = prResult3.StringResult;
                            return SamplerStatus.NoChange;
                        }

                        //if (prResult2.Status == PromptStatus.Cancel) return SamplerStatus.Cancel;

                        if (prResult2.Status == PromptStatus.Keyword)
                        {
                            //Jeżeli naciśnięto Zamień
                            if (prResult2.StringResult == "Zamień")
                            {
                                if (mPunktChwilowy == mPunkt1Biezacy)
                                {
                                    mStartPoint = mPunkt2Biezacy;
                                    mPunktChwilowy = mPunkt2Biezacy;
                                }
                                else
                                {
                                    mStartPoint = mPunkt1Biezacy;
                                    mPunktChwilowy = mPunkt1Biezacy;
                                }
                            }
                            return SamplerStatus.OK;
                        }

                        if (prResult2.Status == PromptStatus.None)
                        {
                            return SamplerStatus.NoChange;
                        }

                        if (prResult2.Status == PromptStatus.Other)
                        {
                            return SamplerStatus.NoChange;
                        }

                        if (prResult2.Status == PromptStatus.Cancel)
                        {
                            return SamplerStatus.NoChange;
                        }

                        else
                        {
                            mEndPoint = prResult2.Value;
                            return SamplerStatus.OK;
                        }
        }

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Autocad Jig Sampler Function C#
« Reply #1 on: July 22, 2014, 03:27:42 PM »
If you aren't happy with the answers here :-

http://forums.autodesk.com/t5/NET/bd-p/152

then you will need to be more explicit with your question.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

dawido000

  • Guest
Re: Autocad Jig Sampler Function C#
« Reply #2 on: July 23, 2014, 01:58:55 AM »
Sorry for my English. I am from Poland :). I try to get from User point3d (as in attachment), but I want to be possibility to get string also. I succeeded, but during entering the string, Editor Input is falshing every inputed letter. I used two functions at the same time.

prompts.AcquireString();
prompts.AcquirePoint();

I admit that I experiment now, because I have no ideas anymore.