Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

error: no function definition: LM:COPYBLOCK

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
790 Views, 6 Replies

error: no function definition: LM:COPYBLOCK

Hi, I am experiencing an issue with my code here, where I am trying to copy a scale bar block from another dwg and place in my active dwg based on the viewport scale. Please see my code maybe you experts can weigh in on the correct procedure I m lacking/missing. 

 

(defun eih(/ $blockname)
(vl-load-com)
(LM:CopyBlock "BS1" "N:\\CAD\\AutoCAD\\SUPPORT\\TT-Blocks.dwg") <-- suspected fault cause? im not too sure
(setq $vp-sc(/ 1 (vla-get-CustomScale (vla-get-ActivePViewport (vla-get-activedocument (vlax-get-acad-object))))))
(command "pspace")
(setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq $blockname "bs1"
)
(setq H1 (strcat (rtos $vp-sc 2 0) "'")
H2 (strcat (rtos (/ $vp-sc 2) 2 0) "'")
H3 "0'"
H4 (strcat (rtos $vp-sc 2 0) "'")
H5 (strcat (rtos (* $vp-sc 2) 2 0) "'")
)
(if (and
; (setq p (getpoint "\nBlock Location :"))
(setq $ins (dos_listbox "Select Insert for Bar Scale" "ANSI Paper Sizes" '("ANSI D (22 x 34)" "Floating") "ANSI D (22 x 34)"))
(cond
((= $ins "ANSI D (22 x 34)")(setq p (list 10.1151 1.5 0.0)))
((= $ins "Floating")(setq p (getpoint "\nBlock Location :")))
)
(setq ib (vlax-invoke
(vlax-get (vla-get-ActiveLayout aDoc)
'Block
)
'InsertBlock
p
$blockname
1
1
1
0
)
)
)
(mapcar '(lambda (j k)
(vla-put-textstring k (eval j))
)
'(H5 H4 H3 H2 H1)
(vlax-invoke ib 'GetAttributes)
)
)
(princ)
)

6 REPLIES 6
Message 2 of 7
Gary_J_Orr
in reply to: Anonymous

the "obvious" answer (or question if you prefer) is

Do you have Lee Mac's "LM:CopyBlock" function loaded prior to trying to call it up?
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 3 of 7
Anonymous
in reply to: Gary_J_Orr

no, so I will seek out another routine on the web. Thanks

Message 4 of 7
Anonymous
in reply to: Gary_J_Orr

hi, i atually dont want to abandon the code, I looked at lee Mac programming and found his stuff is ok to use. Could you give me some help? what I am trying to do is I would like to place a scale bar by VP, with a selection dialog for either a fixed location or floating. I've used this type of action before but do have the original code, So i did my best to put some pieces together to get to the point I'm at now. Thanks

Message 5 of 7
Gary_J_Orr
in reply to: Anonymous


@Anonymous wrote:

hi, i atually dont want to abandon the code, I looked at lee Mac programming and found his stuff is ok to use. Could you give me some help? what I am trying to do is I would like to place a scale bar by VP, with a selection dialog for either a fixed location or floating. I've used this type of action before but do have the original code, So i did my best to put some pieces together to get to the point I'm at now. Thanks


Well, the utility should be on Lee Mac's site, if not a search on here should turn up half a dozen references to it... It is a basic Vlisp ActiveX function for importing a specified block from a specified block library resource file.

Wherever you find it remember that you are using something that he generated for the purpose of keeping yourself fed so I'm sure that he would appreciate a donation for the purposes of keeping himself fed...

 

Once you have that utility you will need to ensure that you have the next one that you call for:

(dos_listbox ...)

It is part of a suite of utilities that goes waaaaay back called "Dos_Library" or something similar.

An option to this last would be to use initget and getkword to retrieve the user's choice from the command line (suggestion based on the fact that you only show two choices).

 

Based upon what I'm seeing from your last post I would also suggest that you do a bit of studying before you go much further. You seem to be at a "just getting started" point but you're grabbing code snippets that use some of the more advanced concepts. Learn the basics first, those things that you can "line-item" until you truly understand what is being done, then look for ways to perform those line items "en-Masse".

 

Depending on your ACAD version the help files can be helpful, but a search on here will provide plenty of links to other learning resources.

 

I'm sorry if I sound like I'm bashing on you. That is not my intent. Vlisp can be fairly straight forward once you understand it, but you need to start at the beginning, not jump in half way through. Start simple. Learn how it works. Understand what is happening.

 

-Gary

 

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 6 of 7
Anonymous
in reply to: Gary_J_Orr

Thanks, I will work on it, some of it I understand and some of it is a little confusing. I appreciate your input.

Message 7 of 7
Anonymous
in reply to: Gary_J_Orr

I just wanted to update this, I figured out the routine, and it works
great.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost