Jump to content

Recommended Posts

Posted

Hi every one.
I want to use initget to get the plot style from the user. In the code, the styles after Screening_50.ctb are not known by the Autocad.
the same thing happens when I add Fill_Patterns.ctb before Screening_50.ctb. how do I solve the problem?

(initget 1 "Monochrome.ctb acad.ctb Grayscale.ctb Screening_50.ctb Fill_Patterns.ctb")
(setq plotstyle (getkword "\nChoose plot style [Monochrome.ctb/acad.ctb/Grayscale.ctb/Screening 50%.ctb/Fill Patterns.ctb] <Monochrome.ctb>: "))

 

Posted
24 minutes ago, shokoufeh said:
(initget 1 "Monochrome.ctb acad.ctb Grayscale.ctb Screening_50.ctb Fill_Patterns.ctb")

 

Inside the "initget" you use "Screening_50.ctb Fill_Patterns.ctb" with "_", and inside the "getkword" you use "Screening 50%.ctb/Fill Patterns.ctb", which is not equal as it in "initget". Everything must be equal. So, according from your's "initget", the "_" can't be in use, because it's in use for localization (for eg. "_RECTANG", "_LINE", etc.). From this link you can find this: 

    Keyword Specifications

          The string argument is interpreted according to the following rules:

             1. Each keyword is separated from the following keyword by one or more spaces. For example, "Width Height Depth" defines three keywords.

             2. Each keyword can contain only letters, numbers, and hyphens (-).

 

One of the possible solutions is to use this:

 

(initget 1 "Monochrome.ctb acad.ctb Grayscale.ctb Screening50.ctb FillPatterns.ctb")
(setq plotstyle (getkword "\nChoose plot style [Monochrome.ctb/acad.ctb/Grayscale.ctb/Screening50.ctb/FillPatterns.ctb] <Monochrome.ctb>:"))

(cond

  ((equal plotstyle "Screening50.ctb")

   (setq plotstyle "Screening_50.ctb")
   
   )

  ((equal plotstyle "FillPatterns.ctb")

   (setq plotstyle "Fill_Patterns.ctb")
   
   )

  )

 

Best regards.

  • Like 1
Posted
5 minutes ago, Saxlle said:

 

Inside the "initget" you use "Screening_50.ctb Fill_Patterns.ctb" with "_", and inside the "getkword" you use "Screening 50%.ctb/Fill Patterns.ctb", which is not equal as it in "initget". Everything must be equal. So, according from your's "initget", the "_" can't be in use, because it's in use for localization (for eg. "_RECTANG", "_LINE", etc.). From this link you can find this: 

    Keyword Specifications

          The string argument is interpreted according to the following rules:

             1. Each keyword is separated from the following keyword by one or more spaces. For example, "Width Height Depth" defines three keywords.

             2. Each keyword can contain only letters, numbers, and hyphens (-).

 

One of the possible solutions is to use this:

 

(initget 1 "Monochrome.ctb acad.ctb Grayscale.ctb Screening50.ctb FillPatterns.ctb")
(setq plotstyle (getkword "\nChoose plot style [Monochrome.ctb/acad.ctb/Grayscale.ctb/Screening50.ctb/FillPatterns.ctb] <Monochrome.ctb>:"))

(cond

  ((equal plotstyle "Screening50.ctb")

   (setq plotstyle "Screening_50.ctb")
   
   )

  ((equal plotstyle "FillPatterns.ctb")

   (setq plotstyle "Fill_Patterns.ctb")
   
   )

  )

 

Best regards.

This solution worked perfectly :)
Thank you so much

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...