TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on July 27, 2014, 12:58:13 AM

Title: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 12:58:13 AM
Hello guys .

I wrote a routine to change a dimstyle for a rotated dimension object to another dimstyle in a block , everything is okay BUT I can't see the changes until I double click on every block to enter the block
then have to save before closing the block .

I added the vla-regen function but it does not work .

Thanks in advance .  :-)
Title: Re: Problem with move to dim style in a block
Post by: David Bethel on July 27, 2014, 08:07:53 AM
Did you try ( entupd ) after the ( entmod )  ?
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 08:28:40 AM
Did you try ( entupd ) after the ( entmod )  ?

Hi David ,

I used the vlisp function vla-put-stylename and not dxf codes .

Any idea ?

Many thanks
Title: Re: Problem with move to dim style in a block
Post by: CAB on July 27, 2014, 10:58:39 AM
Take a look at Lee's code here, perhaps that regen will work for you.
http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/a-lisp-to-make-all-entities-color-quot-by-layer-quot/td-p/4840793/page/2
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 11:31:03 AM
Thank you CAB .

this is the codes .

Code: [Select]
(defun c:toStyle (/ mydoc)
  (vlax-for blks (vla-get-blocks (setq mydoc (vla-get-activedocument (vlax-get-acad-object))))
    (if (eq :vlax-false (vla-get-islayout blks))
      (vlax-for objs blks
        (if (wcmatch (vla-get-objectname objs) "AcDb*Dimension")
          (vla-put-stylename objs "Standard")
        )
      )
    )
  )
  (vla-regen mydoc acallviewports)
  (princ)
)
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 02:39:49 PM
Anyone knows why the changes of the Dimension style not appeared until I open the block manually and save the block ?

 :-(
Title: Re: Problem with move to dim style in a block
Post by: CAB on July 27, 2014, 04:10:41 PM
Shot in the dark but does the command DimRegen have any effect on the insert?
Title: Re: Problem with move to dim style in a block
Post by: roy_043 on July 27, 2014, 04:24:30 PM
Following David's advice: have you tried using vla-update on each dim object?
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 06:10:27 PM
Following David's advice: have you tried using vla-update on each dim object?
Shot in the dark but does the command DimRegen have any effect on the insert?

No luck at all .  :-o
Title: Re: Problem with move to dim style in a block
Post by: CAB on July 27, 2014, 06:28:32 PM
Can you post a test DWG of your block(s)?
Title: Re: Problem with move to dim style in a block
Post by: Kerry on July 27, 2014, 06:30:41 PM
Can you post a test DWG of your block(s)?

... and an explicit description of your intent.
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 27, 2014, 06:35:35 PM
This is a sample block that I am working on .

many thanks for your help CAB
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 28, 2014, 04:50:26 AM
Can you post a test DWG of your block(s)?

... and an explicit description of your intent.

Thanks Kerry for your interests in helping me  :-)

My codes in post no #4 can change the Dimension style name to Standard , but I can not see the changes of the new style until I double click on the block to enter the block and close it after that to see the new changes .
The vla-regen does not work as it works with the other modifications on blocks .

Many thanks
Title: Re: Problem with move to dim style in a block
Post by: CAB on July 28, 2014, 08:35:32 AM
I worked on it last night with no luck.
No time today.  :?
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 28, 2014, 08:43:55 AM
I worked on it last night with no luck.
No time today.  :?

Did you have the same outcome that I have already described and couldn't see the changes unless to reopen and save the block ?
Title: Re: Problem with move to dim style in a block
Post by: CAB on July 28, 2014, 09:24:35 AM
Exactly!!  :(
Title: Re: Problem with move to dim style in a block
Post by: LE3 on July 28, 2014, 09:45:58 AM
no idea, but maybe there are these two methods or something related/similar in vlisp?

Code - C#: [Select]
  1. dimension.RecomputeDimensionBlock(true);
  2. dimension.RecordGraphicsModified(true);
Title: Re: Problem with move to dim style in a block
Post by: Coder on July 29, 2014, 11:10:39 AM
no idea, but maybe there are these two methods or something related/similar in vlisp?

Code - C#: [Select]
  1. dimension.RecomputeDimensionBlock(true);
  2. dimension.RecordGraphicsModified(true);

Thank you LE for your reply .

I searched for an equivalent function in lisp but couldn't find anything , do you have any suggestion ?
Thank you .