Jump to content

Recommended Posts

Posted

FWIW - You might consider storing the ActiveDocument to a variable prior to the If statement, as this can be used for many things. Depending on the task, it may be simpler to use a Setq near the top of the Defun, or even supply the ActiveDocument Call to a Lambda expression as an argument.

 

One example of how I use this in addition to the vla-* code, is with the vla-StartUndoMark, and vla-EndUndoMark functions with my *error* handler. Just a thought.

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

  • CadFrank

    40

  • ReMark

    9

  • BlackBox

    9

  • pBe

    7

Top Posters In This Topic

Posted
Yes. You can retrive the parameters and values directly as such in your case, where there is only one parameter and the allowed values are explicitly listed on the initget keywords and then theres only one attribute. so this line of code will work

 

Well thanks, for the info and the help..

 

Not that I want to sound mean in this but I got a flash this morning after posting my last question.. hehe.. but I had code with something similar..stupid me shoulda though of it before hehe.

 

well ill still study the code you gave me so i can understand it.

 

Thanks again.

 

Cheers & Beers

Posted
FWIW - You might consider storing the ActiveDocument to a variable prior to the If statement, as this can be used for many things. Depending on the task, it may be simpler to use a Setq near the top of the Defun, or even supply the ActiveDocument Call to a Lambda expression as an argument.

 

One example of how I use this in addition to the vla-* code, is with the vla-StartUndoMark, and vla-EndUndoMark functions with my *error* handler. Just a thought.

 

Are you trying to make my head pop :P. way to much information here haha!!

  • 1 month later...
Posted

Hello, So I'm still on the same code here but with new Dynamic block hehe.. In this DB I have 2 Look up and i can't seem to find the way to get 1 of them tried a few things. I went with pBe information to try and find it.

 

(defun c:BB (/ pt5 B-B-blk B-B-dbp)
 
 (setq pt5 '((400000 800000 0) . "LC BASES"))
 (setq D-Base "6.0")
 (setq H-Base "1.65")
 

  (if (setq B-B-blk (vla-insertblock
               (vla-get-modelspace
                 (vla-get-activedocument
                   (vlax-get-acad-object)))
                     (vlax-3d-point (car pt5)) (cdr pt5) 1 1 1 0)

     )
   (progn (setq  B-B-dbp (car (vlax-invoke B-B-blk 'GetDynamicBlockProperties)))
          (vla-put-value  B-B-dbp (strcat D-Base " m"))
         
   )
 )
 (princ)

); fin

So anywho ill try to find it but if some1 can give me a hint.. Please do not try to make my head pop :lol:.

 

And ill link the Dblock with this post.

 

Cheers & Beers !

New Base.dwg

Posted

snipp... snipp

 

(defun c:BB (/ pt5 B-B-blk )
 (setq pt5 '((400000 800000 0) . "LC BASES"))
 (setq D-Base "6.0")
 (setq H-Base "1.65")
  (if (setq B-B-blk (vla-insertblock
               (vla-get-modelspace
                 (vla-get-activedocument
                   (vlax-get-acad-object)))
                     (vlax-3d-point (car pt5)) (cdr pt5) 1 1 1 0)

     )
   [color=blue](mapcar '(lambda (x y)[/color]
[color=blue]                  (vla-put-value x y))[/color]
[color=blue]           (vl-remove-if-not[/color]
[color=blue]                 '(lambda (s)[/color]
[color=blue]                        (member (vla-get-PropertyName s)[/color]
[color=blue]                                '("DIMENSION BASE" "EPAISSEUR BASE")))[/color]
[color=blue]                 (vlax-invoke B-B-blk 'GetDynamicBlockProperties))[/color]
[color=blue]           (list [color=black](strcat H-Base " m") (strcat D-Base " m")[/color]))
[/color])
 (princ)
)

 

At any rate.. i would've coded it differently :)

Somehow you need to show us the big picture, that way we can make a "generic" routine to work with any DBlock configuration. As of now the snippet will work within a very specific condtion. (well not really :D)

 

HTH

 

EDIT: I just saw your new thread. I've have a look see tomrw.

Posted
EDIT: I just saw your new thread. I've have a look see tomrw.

 

Well thx pBe well as you can see I found a way to make it work but i get a weird error.

 

I also posted my full code in the other tread.

 

Ill try yours to see if it does change something.

 

Cheers & Beers.

Posted
Well thx pBe well as you can see I found a way to make it work but i get a weird error.

 

Ill try yours to see if it does change something.

 

Cheers & Beers.

 

Tell me how it goes CadFrank.

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