Jump to content

Recommended Posts

Posted

I have a lisp which insert mleader with block and the block has attribute. while i use that lisp code it inserted the block but the attribute font and text size has been changed. How to change its attribute font and text size. Please anyone help!!!  

Posted

The LISP and the drawing file would help.

Posted

Sure, here is the DWG and lisp file. 

In DWG files there are two blocks with line. I want to automate it with mleader. 

test.lsp.lsp Test_file.dwg

Posted

The block is inserted as it's made.

I'm not sure if I understand the problem.

 

Anyway, I edited your block, I name the block "ROADWORDAHEAD" 

(I'm oldfashionned, I think blocknames better not have space characters)

I changed the attribute size in the block edit.

 

I also switched the caption of point 1 and point 2. (feel free to put them back)

Command: BP

 

See if this code works with the file I uploaded

 

 

(defun c:bp ( / block_name pt1 pt2 num dim ent obj)
	(setq cmd (getvar "cmdecho"))            
	(setvar "cmdecho" 0)
	(setq atd (getvar "attdia"))
	(setvar "attdia" 0)

	(setq block_name "ROADWORDAHEAD") 
	(setq pt1 (getpoint "\nSelect block insertion point: "))
	(setq pt2 (getpoint pt1 "\nSelect object insertion point: "))

	(setq num "W20-1")
	(setq dim " ")

	(command "mleader" "o" "c" "b" block_name "x" pt2 pt1)		;;  num dim 

	(setq ent (entlast))
	(setq obj (vlax-ename->vla-object ent))
	(vla-put-ArrowheadSize obj 0)
	(vla-put-ScaleFactor obj 6.86)

	(setvar "attdia" atd)
	(setvar "cmdecho" cmd)           
	(princ "\nComplete!")
	
	(princ)
)

 

 

 

Test_file.dwg

Posted

A comment, do you know how to make a pop menu or a tool palette ? This is a very easy way of choosing your block to use. You can have multiple groups of blocks so choose from one catergory a sign of the one type. Same with your speed tables which at moment in this dwg are A$C261F4F67 rather than proper block name. 

 

image.png.eac850830383990f7a551835d9bcb60f.png

 

There is ways of short cutting the making of a mnu.

Posted
On 9/6/2024 at 12:02 PM, Emmanuel Delay said:

The block is inserted as it's made.

I'm not sure if I understand the problem.

 

Anyway, I edited your block, I name the block "ROADWORDAHEAD" 

(I'm oldfashionned, I think blocknames better not have space characters)

I changed the attribute size in the block edit.

 

I also switched the caption of point 1 and point 2. (feel free to put them back)

Command: BP

 

See if this code works with the file I uploaded

 

 

(defun c:bp ( / block_name pt1 pt2 num dim ent obj)
	(setq cmd (getvar "cmdecho"))            
	(setvar "cmdecho" 0)
	(setq atd (getvar "attdia"))
	(setvar "attdia" 0)

	(setq block_name "ROADWORDAHEAD") 
	(setq pt1 (getpoint "\nSelect block insertion point: "))
	(setq pt2 (getpoint pt1 "\nSelect object insertion point: "))

	(setq num "W20-1")
	(setq dim " ")

	(command "mleader" "o" "c" "b" block_name "x" pt2 pt1)		;;  num dim 

	(setq ent (entlast))
	(setq obj (vlax-ename->vla-object ent))
	(vla-put-ArrowheadSize obj 0)
	(vla-put-ScaleFactor obj 6.86)

	(setvar "attdia" atd)
	(setvar "cmdecho" cmd)           
	(princ "\nComplete!")
	
	(princ)
)

 

 

Thanks for replying. Actually I need to do it program not in DWG file

 

Test_file.dwg 3.9 MB · 2 downloads

 

Posted
On 9/7/2024 at 4:43 AM, BIGAL said:

A comment, do you know how to make a pop menu or a tool palette ? This is a very easy way of choosing your block to use. You can have multiple groups of blocks so choose from one catergory a sign of the one type. Same with your speed tables which at moment in this dwg are A$C261F4F67 rather than proper block name. 

 

image.png.eac850830383990f7a551835d9bcb60f.png

 

There is ways of short cutting the making of a mnu.

No I don't know how to make this. I am new in this field.

Posted (edited)

Ok making a mnu file is easy using notepad, you load a mnu file using the Menuload command. A menu can have pop menu's, toolbars, images and digitiser. All in on menu.

 

This method is very old so the images are Slides just do MSLIDE it will capture your current cad image Vslide lets you have a look at it. You can use a lisp to make the slides I have made like a 100 in one go.

 

Were I used to work we tended to have all the blocks as separate dwg's but saved in a common directory and only had the blocks that we really needed in the dwt.

menu2.png.31566e48b6a2d6983b201aef0e2412c0.png

 

The pop menu in the image has like 130 lisps behind it. 

 

Ok how to start, the simplest is make a pop menu for say your DWT that matches all the blocks inside it. Like your sample dwg. Fix the blocks by using rename for the blocks that are named A$C261F4F67 etc. Send me a PM with say this dwt attached and will get you started. You can add more blocks even in other dwg's.

 

 

 

 

 

Edited by BIGAL

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