Jump to content

How to dim slope and taper


lucas3

Recommended Posts

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

  • lucas3

    26

  • vimcruz

    15

  • MSasu

    8

  • Snownut

    6

Top Posters In This Topic

Posted Images

sorry,lucas,This is part of the paid software.

That's not very sporting of you, I've seen your request for plenty of "free" programing services....

Link to comment
Share on other sites

After 2 days of work I've finished what OP asked for. Gonna post it as soon as I get home.

 

Regards

 

Thank you! vimcruz ,That's great! I am very much looking forward

Link to comment
Share on other sites

First things first. You must edit the slope.lsp file to set the path to the DCL file, or add the path to the "Support File Search Path".

 

How it works:

 

1. Draw a line or pline with some inclination

2. Once you have loaded the slope.lsp use the function: "slope"

3. Click the first point of the line

4. Click the second point of the line

5. Select the mode in the DCL

6. Set the text size

7. Click on desire point to display the text

 

This is just the fast version of something that could be a nice tool. I know I just recently started working with AutoLisp and DCL, but I'm getting better and I'll polish this tool to make it better. If you have any questions about the code feel free to ask. I'll do my best to answer. If you find some bug or I made a mistake don't hesitate to post it, I'll fix it asap.

 

Licence:

Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)

 

EDIT:

 

Line to modify

46.  (setq dcl_id (load_dialog [color="red"][b](strcat (getvar 'MYDOCUMENTSPREFIX) "\\DCL\\slope.dcl")[/b][/color])) ;EDIT THIS!

 

EDIT: Last update slope_v2.1.0.lsp, no need to download DCL file

slope.lsp

slope.dcl

slope_v2.1.0.lsp

Edited by vimcruz
Link to comment
Share on other sites

vimcruz,Thank you very much!

 

Always show:“The slope definition could not be loaded!”,later snap miss

I put slope.lsp and slope.dcl in "C:\Program Files\AutoCAD 2010\Support"

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "slope.dcl"))) ,Is can't

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "\\C:\Program Files\AutoCAD 2010\Support\slope.dcl"))) ,can't too

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "C:\\Program Files\\AutoCAD 2010\\Support\\slope.dcl"))) ,can't too

Link to comment
Share on other sites

vimcruz,Thank you very much!

 

Always show:“The slope definition could not be loaded!”,later snap miss

I put slope.lsp and slope.dcl in "C:\Program Files\AutoCAD 2010\Support"

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "slope.dcl"))) ,Is can't

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "\\C:\Program Files\AutoCAD 2010\Support\slope.dcl"))) ,can't too

I modify the path:(setq dcl_id (load_dialog (strcat (getvar 'MYDOCUMENTSPREFIX) "C:\\Program Files\\AutoCAD 2010\\Support\\slope.dcl"))) ,can't too

 

Try this:

 

(setq dcl_id (load_dialog "C:\\Program Files\\AutoCAD 2010\\Support\\slope.dcl"))

Link to comment
Share on other sites

Try this:

 

(setq dcl_id (load_dialog "C:\\Program Files\\AutoCAD 2010\\Support\\slope.dcl"))

 

OK! thanks ,(setq dcl_id (load_dialog "slope.dcl"))

Link to comment
Share on other sites

Lucas3, please don't miss that the original code was calling to place the dialog definition into MyDocuments folder; by placing it into AutoCAD's installation folder may lose them when will re-install it or switch to another version.

Link to comment
Share on other sites

Vimcruz, nice work! If you don't mind, I would make some comments on your code:

 

It may be useful to validate user's input before proceeding to processing:

(if (and (setq p1 (getpoint "\nFirst pick point: "))
 (setq p2 (getpoint "\nSecond pick point: ")))
(progn
 ...

 

Please pay attention that you were disabling auto OSNAP after calling a draw command, so that may be affected by current modes:

(command "_.pline" newp1 newp2 "")     
(setq osm (getvar "OSMODE"))
(setvar "osmode" 0)

 

A good programming practice is to fully restore the environment you affected, so it will be better to retain the original *error* function into a variable and replace the one you defined at the end or on error (similar with what you did for OSMODE system variable).

 

A call to UNDO command inside the error handling function will ensure that user isn't left with an incomplete result if the error occurs after some entities were already drew.

 

For mode choosing, you may want also to take a look to GETKWORD and INITGET functions (to get rid of dialog box).

If you decide to stick with the dialog, it may be useful to add a field for text height into it; also by using radio-buttons instead of buttons for modes will be able to prompt the user with previously used mode as default.

 

Last, but not least, you should localize your variables to make sure don't interfere with other routines.

Link to comment
Share on other sites

MSasu, thx for the tips!. I tried to make it work with radio_button in DCL, but I didn't understand how to restore previous selection. As I said I just started with Autolisp but with this kind of help I'll be better. I'll be making changes along the next week keeping in mind what you said. Feel free to re-use the code if needed.

 

Lucas3, by the end of this week I'll have time to improve the code. If you could wait till that day...

 

Regards

Edited by vimcruz
Link to comment
Share on other sites

MSasu, thx for the tips!. I tried to make it work with radio_button in DCL, but I didn't understand how to restore previous selection. As I said I just started with Autolisp but with this kind of help I'll be better. I'll be making changes along the next week keeping in mind what you said. Feel free to re-use the code if needed.

 

Lucas3, by the end of this week I'll have time to improve the code. If you could wait till that day...

 

Regards

 

Thank you vimcruz,I will wait for you!

Have you seen #14 and #16 ?

Link to comment
Share on other sites

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...