Jump to content

Recommended Posts

Posted

Hello everybody,

First of all: I know that I can set an insert layer in the block palette.
I have a question.
Would it be possible or is there something like this and a reactor that can determine the layer when inserting a block via the Design Center?
And about the layer name that I enter in the block description. Not the block name!
For example, in a block description wall.
When I paste this block, the reactor should recognize the layer name in the block properties and set the current layer to wall.
This would be for me and certainly for many others a relief in dealing with blocks and layers.

Many thanks

Martin

Posted (edited)

Yours When I paste this block, the reactor should recognize the layer name in the block properties and set the current layer to wall.

 

Mine When I choose to paste a block pick its name and set the current layer to "blocks layer" I would use MYINSERT.

 

Myinsert is a lisp that has not been written yet. Not sure how to interact with design centre. May be easier to just do as a modify last object.

 


(defun AH:CHLAST ( /  ent obj blk)
(setq ent (entlast))
(setq obj (vlax-ename->vla-object ent))
(vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(if (= (vla-get-name obj)(vla-get-name blk))
(vlax-for ent blk
    (princ (setq lay (vla-get-layer ent)))
)
)
)
(command "chprop" ent "" "LA" lay "")
)
(AH:CHLAST)

 

 

Edited by BIGAL
Posted

Hello BIGAL,

Thanks for your kind and quick help.
Las Lisp works very well. But I always have to do it extra. Unfortunately, I can not combine that with the design center.
I prefer the design center because I see all blocks directly.
With the command "_-insert" I have to know the name of the block. I do not always know that.
I thought that a reactor would be a good solution.
If you could put your Lisp in a reactor this would be the optimal solution.
Thanks again for your help!

Martin

Posted

I use menu's for my std block insert you can add lisp to the sequence of commands have as many blocks as you like under a group heading if you can use notepad you can create.

ScreenShot027.jpg

Posted

Hello BIGAL
looks great.
Unfortunately I can not do such a tile menu myself. Unfortunately, I am not a professional.
Could one with this menu also the Einfügelayer in advance determine?

Best regards

Martin

Posted

Its actually very easy to make its part of Autocad menu's. In a pull down menu you have sections one of those is to have icons. In simple terms you have a line that calls a group of icons Autocad does all the hard work so if you have more than 16 icons it makes extra pages automatically. The lable on the side is read from the menu see below

 


***POP20
**CADLIB
             [LIBRARY]
             [->Stddwgs]
             [TRENCH]$I=STDS.TRENCH $I=*
             [PIPES]$I=STDS.PIPES $I=*
             [PITS]$I=STDS.PITS $I=*
             [KERBS]$I=STDS.KERBS $I=* this is the kerbs call  as shown in the image

 

this is one of many image sections in my menu

***image

**KERBS
[KERBS]
[GGSLD(SD401,B1 KERB)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG401") 
[GGSLD(SD402,B2 KERB)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG402") 
[GGSLD(SD403,B3 KERB)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG403") 
[GGSLD(SD404,LAYBACK B2-3)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG404") 

 

Ok the how to do it.

You make "slides" of your blocks.

Just get a block on the screen and type SLIDE. This makes the image

 

You can see that in the code above there is "openblk" this is actually a preloaded lisp program to do certain things much like your request to set layers. Or in simple terms you would do a Insert. Using images allows you to do multiple lisp ^c^c(lisp1)(then lisp2)

 

One of the tings you can take advantage of is scripting the making of the slides so you just watch the flashing screen, it is that fast.

 

You need to work out your groups of blocks not much good just doing a hundred blocks in one menu. Look at the images items like cars is 20 blocks to choose from.

 

Ok you need a little program to get started you need to make a text file of your block names. I have hundreds made up of my template and external dwgs so it does take a liitle bit of time but there are so many shortcuts if you know about them. Just had a look I have 354 slides in one directory, but you can have slide libraries makes life easier joining multiple into a single.

 

I Use ms Word and excel to create the menu as they have good copy and replace functions, repeating over multilpe lines.

 

Here is a dump of your blocks in a dwg. please run this and post the slides.txt file and will create a sample file for you.

 


; make temp directory
(if (vl-file-directory-p "C:\\Acadtemp\\")
(Princ "Acadtemp exists")
(vl-mkdir "C:\\AcadTEMP\\")
)
(setq  blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))

(setq fo (open (setq fname "c:\\acadtemp\\Slides.txt") "w"))
(vlax-for blk blocks
(if   (/= (substr  (vla-get-name blk) 1 1) "*" )
(write-line (vla-get-name blk) fo)
)
)
(close fo)

 

 

 

 

 

Posted

Hello BIGAL,

Thank you for your detailed explanation. Sounds very interesting. I will try to replicate this.
When you see the finished program it looks very easy. :)
But that could be a good solution for me.
Thank you!

Best regards

Martin

Posted

After running the block name dump make a master copy of it, then delete the file down to say one group of blocks, then we can work on the making slides.

 

script for making slides.


filedia 0
-Insert block1 0,0 1 1 0
mslide c:/acadtemp/block1.sld
-Insert block2 0,0 1 1 0 att1 att2 att3
mslide c:/acadtemp/block2.sld
-Insert block3 0,0 1 1 0
mslide c:/acadtemp/block3.sld

 

I will redo the block name stuff to add how many attributes or else it will crash on the INSERT.

 

Using the block name list you can make the menu pretty quick as well. Hence its like a 3 step process.

Posted

Hallo BIGAL

Danke für deine Hilfe! Ich werde es versuchen😅

Posted

Added the insert etc


; make a text file of block names
; By Alan H April 2019

; make temp directory
(if (vl-file-directory-p "C:\\Acadtemp\\")
(Princ "Acadtemp exists")
(vl-mkdir "C:\\AcadTEMP\\")
)
(setq  blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))
(setq fo (open (setq fname "c:\\acadtemp\\Slides.txt") "w"))
(vlax-for blk blocks
(if   (/= (substr  (vla-get-name blk) 1 1) "*" )
(write-line (strcat "-insert "(vla-get-name blk) " 0,0 1 1 0") fo)
)
)
(close fo)

Posted

There is more smarts do you have MS word you can add heaps of stuff to begining or end of line using the ^p which is end of line Replace ^p with ^pThis is a test by BIGAL you can also do before ^p replace test by bigal^p

 

Google translate

Es gibt mehr Klugheiten. Haben Sie ein MS-Wort? Sie können dem Zeilenanfang oder -ende Haufen mit dem ^ p hinzufügen. Dies ist das Zeilenende. Ersetzen Sie ^ p durch ^ p von bigal ^ p

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