Jump to content

Lisp needed for dimensions with block


Recommended Posts

Posted

Hi all,

 

I have very basic knowledge in lisp and created very basic lisps.

 

But now i tried one lisp, i.e, Dimensions with specified block in current scale. And also the block insert point should be inserted at mid point of dimension line.

 

Or,

 

after i created number of dimensions, a block would be inserted at all dimensions mid point of dimension lines.

 

i tried my level best but cannot figure out.

could anyone help me to get a lisp for the above. so i too can learn how it was done.

 

thanks in advance.

Posted

I think I understand what he wants - simply add a block in the middle of a dimension line

 

I have no idea how to do that either.....be interested to see what anyone comes up with

Posted

Hi Tharwat,

 

Here is what im looking for. Thanks for your help.

 

I tried a little bit,

-----------------------

(setvar "dimtad" 2)

(command "_dimlinear" pause pause "M" pause pause) ;need pause for user input for dimension text

(setq P (getvar "lastpoint"))

(command "ddedit" "l" pause "" "")

(command "_insert" "block1" "_s" "1" P "0")

(setvar "dimtad" 1)

(princ)

 

But the dimension text window didnot appear to override the value.

Capture.JPG

Posted

*- Which one is the block , the circle or the rectangle ?

*- What is the name of the block?

*- Is it aligned or linear dimensions ?

Posted

Oh i'm sorry.

 

The ellipse is the block. the name was "bubble" and mostly i using linear dimensions but some times need to use aligned or rotated dimensions too.

 

thank you.

Posted

Upload a sample drawing showing clearly your needs of the program if possible.

 

As for aligned dimensions , if the needed block would be inserted between the two extension lines , the block won't be identical to other since linear dimensions could have different length of extension lines. got it?

Posted

This should retrieve the information on the 1st TEXT type entity in a DIMENSION.

 

You can then calculate the insert point, scale and rotation angle.

 

[b][color=BLACK]([/color][/b]defun c:dim-ted [b][color=FUCHSIA]([/color][/b]/ ss en ed dn td fe fd tl[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]not en[b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]and [b][color=MAROON]([/color][/b]setq ss [b][color=GREEN]([/color][/b]ssget [b][color=BLUE]([/color][/b]list [b][color=RED]([/color][/b]cons 0 [color=#2f4f4f]"DIMENSION"[/color][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]= [b][color=GREEN]([/color][/b]sslength ss[b][color=GREEN])[/color][/b] 1[b][color=MAROON])[/color][/b]
             [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss 0[b][color=GREEN])[/color][/b]
                   ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                   dn [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 2 ed[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                   td [b][color=GREEN]([/color][/b]tblsearch [color=#2f4f4f]"BLOCK"[/color] dn[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]

 [b][color=NAVY]([/color][/b]setq fe [b][color=MAROON]([/color][/b]cdr [b][color=GREEN]([/color][/b]assoc -2 td[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
 [b][color=NAVY]([/color][/b]while fe
    [b][color=MAROON]([/color][/b]setq fd [b][color=GREEN]([/color][/b]entget fe[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
    [b][color=MAROON]([/color][/b]if [b][color=GREEN]([/color][/b]member [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 0 fd[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b] '[b][color=BLUE]([/color][/b][color=#2f4f4f]"TEXT"[/color] [color=#2f4f4f]"MTEXT"[/color][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
        [b][color=GREEN]([/color][/b]setq tl [b][color=BLUE]([/color][/b]cons fd tl[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
    [b][color=MAROON]([/color][/b]setq fe [b][color=GREEN]([/color][/b]entnext fe[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1 [b][color=NAVY]([/color][/b]car tl[b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

Depending on your DIMSTYLE setup, to say this will be easy would be misleading.

 

HTH -David

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