TheSwamp

CAD Forums => CAD General => Dynamic Blocks => Topic started by: Luke on February 27, 2008, 05:04:16 PM

Title: DB Inserting
Post by: Luke on February 27, 2008, 05:04:16 PM
I've created these attached DB's.

Can anybody tell me how to change...
1) the default visibility state they insert at.
2) the default lookup property they insert at.

I am inserting using a pulldown menu with the following macro(s)... ^C^C-insert;LCC_XXXX;sc;1;r;0;
Change XXXX accordingly

Title: Re: DB Inserting
Post by: whdjr on February 27, 2008, 06:06:51 PM
Inserting from a pull-down menu is the same as inserting from a toolbar in which case I don't believe you can change the properties of the block before you insert it.

However if you were inclined to insert from the tool palettes then you would have that option.  I don't know of another way.

Sorry  :-(
Title: Re: DB Inserting
Post by: Luke on February 27, 2008, 06:19:18 PM
Any idea how to control which visibility state is selected on insert?  I don't want to be able to choose or change it every time, I just want to make a different one active than how it is currently coming in...
Title: Re: DB Inserting
Post by: Birdy on February 27, 2008, 06:41:41 PM
Luke, I gotta agree with Will.
Inserting from a Tool Palette will do what you want.
Right click-properties and look for the visibility state to insert at.
Otherwise........:(
Title: Re: DB Inserting
Post by: TimSpangler on February 28, 2008, 07:29:33 AM
I believe you would have to roll your own type of insert for that.

Insert
Grab insert
Change that insert
Exit

Then just run your custom insert from the pull down.
Title: Re: DB Inserting
Post by: Luke on February 28, 2008, 08:00:18 AM
Tim,

Not sure what you mean by "roll own type of insert"??

I'd love to use tool pallets but just not realistic.  My guys complain now about how little drawing area they haave due to small monitors and excess toolbars.
Title: Re: DB Inserting
Post by: whdjr on February 28, 2008, 08:43:20 AM
You do realize the tool palettes can be set to come out and then retract when done don't you?
Title: Re: DB Inserting
Post by: Guest on February 28, 2008, 08:58:17 AM
Tim,

Not sure what you mean by "roll own type of insert"??

I'd love to use tool pallets but just not realistic.  My guys complain now about how little drawing area they haave due to small monitors and excess toolbars.

Are you aware that you change the appearance of the tool palettes to mimick a toolbar (sort of) by changing the view of the palette?  (see image below).

As for Tim's comment, he means you'd have to create a custom insert routine to change the vis state on the fly (or you can just use this).

Code: [Select]
;;;=================================================================================================
;;; Function:    DYNAMIC_BLOCK_SETPROPERTY
;;;
;;; Description: Inserts a dynamic block, changes a specified property
;;;              and automatically highlights it to enable dynamic grips
;;;=================================================================================================
(defun DYNAMIC_BLOCK_SETPROPERTY (strBlockPath strBlockName strPropName strPropValue strAtt /
                                       lista lts pickset1 insPT objLast)
   (setvar "attdia" 0)
   (setq insPT (getpoint "\n Pick insertion point..."))

   (setq lts (getvar "ltscale"))

   (if (= strAtt "")
      (progn
         (if (= (tblsearch "block" strBlockName) nil)
            (command "-insert" (strcat strBlockPath strBlockName) insPT lts lts "")
            (command "-insert" strBlockName insPT lts lts "")
         )
      )
      (progn
         (if (= (tblsearch "block" strBlockName) nil)
            (command "-insert" (strcat strBlockPath strBlockName) insPT lts lts "" (strcase strAtt))
            (command "-insert" strBlockName insPT lts lts "" (strcase strAtt))
         )
      )
   )

   (setq objLast (entlast))

   (setq obj (if (= (type objLast) 'vla-object) objLast (vlax-ename->vla-object objLast)))
   (if (= (vlax-get-property obj 'isdynamicblock) :vlax-true)
      (progn
         (setq v (vla-getdynamicblockproperties obj)
               vval (vlax-variant-value v)
               sal  (vlax-safearray->list vval)
               tot  (length sal)
               i     0
         )
         (while (< i tot)
            (if (= (vlax-get-property (nth i sal) "PropertyName") strPropName)
               (progn
                  (vlax-put-property (nth i sal) "Value" strPropValue)
                  (setq i tot)
               )
               (setq i (1+ i))
            )
         )
      )
   )

   (setq pickset1 (ssadd))
   (ssadd objLast pickset1)
   (sssetfirst nil pickset1)
   (princ)
)

And the code behind the button would look something like this...

Code: [Select]
^C^C^P(load "Blocks.lsp");(Dynamic_Block_SetProperty "YourDir" "Your Block Name" "Visibility" "Visibility State Name" "");
And if the DB you are inserting has attributes and you want to auto-magically fill in the value...

Code: [Select]
^C^C^P(load "Blocks.lsp");(Dynamic_Block_SetProperty "YourDir" "Your Block Name" "Visibility" "Visibility State Name" "Your Attribute Value");
Title: Re: DB Inserting
Post by: TimSpangler on February 28, 2008, 12:44:05 PM
Yeah!  What Matt said.


Thanks Matt.   :-P
Title: Re: DB Inserting
Post by: Luke on February 29, 2008, 11:06:11 AM
OK so you talked me into it.  I'm going to insert through the tool pallet.  However this block is not working for me and I've rebuilt it several times.  Can anybody help me figure it out.

When I insert the block through the standard insert command visibility and lookup values all function as I intended.  When I insert it through the tool pallet with the Lookup Value Property set to any scale other than 12" = 1' the attributes come in all out of wack.  Not quite sure why or how to fix.