Jump to content

Basic LISP help required


FrankPB

Recommended Posts

I have no word to say Lee. Two words may be - perfect work and thank you. It's so usefull, safe time and so on. I'd done already my own buttons (and short keywords) for these lisps and use them at 100% of my working time :). If I have to be honest, I'd made some corrections to it for fields in the lisp. I have no experience for making lisps, for fields - little more. I'd tried to change lisp with the request in the last post to you, but I've never do that - it is knowledge for another dimension, so I'd asked you ... Thank you again.

Link to comment
Share on other sites

  • Replies 36
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    13

  • FrankPB

    5

  • wjp3wjp3

    5

  • kasra

    3

Top Posters In This Topic

Posted Images

  • 4 months later...

Dear Lee Mac,

 

You are really amazing...i've been looking for this routine for years....Thank you (english), Salamat (filipino), shokran (arabic)

Can you give me your email add?

Link to comment
Share on other sites

Dear Lee Mac,

 

You are really amazing...i've been looking for this routine for years....Thank you (english), Salamat (filipino), shokran (arabic)

Can you give me your email add?

 

You're very welcome, I'm glad you like it.

Link to comment
Share on other sites

  • 1 year later...

Lee Mac:

 

Everyone seems to have success with this but me.

 

After selecting the polyline and the text I get this message:

 

** Error: ActiveX Server returned the error: unknown name: GETOBJECTIDSTRING **

 

I am using AutoCAD 2008 SP 1 on Windows 7 64 bit. I have been trying to find a replacement for an areatag lisp similar to yours that worked fine on 32x put does not work on 64x.

 

Any thoughts?

 

Thanks,

 

John

Link to comment
Share on other sites

Hi John,

 

I believe I know where the problem lies, however, there are quite a few code posts in this thread, which post are you referring to?

 

Lee

Link to comment
Share on other sites

Lee,

 

I have had trouble with any lisp routine that uses a variant of GETOBJECTIDSTRING. I tried a number of yours from this thread and always got the same result.

 

This post claims that GETOBJECTIDSTRING is not available in AutoCAD 2008:

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Area-Label-64bit-problem/td-p/2372205/page/2

 

In the same thread I found a routine posted by one of the contributors that gets the job done, although it is not the cleanest code. It works, however, so I am happy. I would welcome any thoughts on tightening up the code:

 

From http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Area-Label-64bit-problem/td-p/2372205

 

(defun GetObjectID(ename / handle xUSERS1 obj objID)
(if (= (getenv "PROCESSOR_ARCHITECTURE") "x86")
(progn ;32-bit
(setq obj (vlax-ename->vla-object ename)
objID (itoa (vla-get-objectid obj))
)
)
(progn ;64-bit
(setq handle (cdr (assoc 5 (entget ename))))
(command ".VBASTMT" (strcat "ThisDrawing.SetVariable \"USERS1\", CStr(ThisDrawing.HandleToObject(\"" handle "\").ObjectId)"))
(setq objID (getvar "USERS1"))
)
)
objID
)

Thanks.

 

John

Edited by wjp3wjp3
Putting code in snippets
Link to comment
Share on other sites

My apologies, SLW210, I am new to the forum. My post has been edited with the code brackets.

 

-John

Edited by wjp3wjp3
Link to comment
Share on other sites

My apologies, SLW210, I am new to the forum. My post has been edited with the code brackets. But now that I have edited it it has disappeared from the thread! What happened?

 

-John

 

Thanks, post needed to be approved because of the links. Until you get 10 posts anything you post with links needs approval by a moderator. Should be there now. :thumbsup:

Link to comment
Share on other sites

Lee:

 

If I understand what is happening with this, it is successfully detecting that getobjectidstring is not an applicable method, but as a result it the object ID is incorrect in the field it generates. This was the original problem that started me on my search for a 64bit compliant routine.

 

This is the field that resulted from using the A2F routine in AutoCAD 2008 64 bit on Windows 7: %%).Area \f "%lu6%qf1">%

 

I will stick with what I posted before. It is working.

 

Thanks,

 

John

Link to comment
Share on other sites

I thought you may have been running a 32-bit version of CAD on a 64-bit machine, hence maybe the getobjectidstring method wasn't implemented, but as you say, maybe 2008 doesn't offer this method.

 

The workaround that you are using uses a VBA statement to set the ObjectID to the USERS1 System Variable; just be aware that this may not work in later versions where VBA is not supported.

 

Lee

Link to comment
Share on other sites

Thanks, Lee. I will keep your routines in my back pocket for when we upgrade AutoCAD. I have only seen one forum post that indicates that ACAD2008 x64 does not support getobjectidstring, but that seems to be the only explanation for why these don't work.

 

-John

Link to comment
Share on other sites

Hi guys,

 

Could one of you help? Is there a way to add and subtract areas of several polylines by modifying this lisp? Your help is much appreciated.

Link to comment
Share on other sites

  • 2 years later...

Hello, can i ask help, i also have problem about cumulative area and lengths, how can i get those cumulative areas display in the properties? and about codes, how can i use it or where will i paste it? thank you so much.

Link to comment
Share on other sites

  • 4 years later...
Happy to help Frank :)

Hi Lee!

 

I´m a newbie to LISP coding.

I have to solve something similar.

I already have a very large facility CAD plans, populated with room tag blocks with ATTRIB MTEXTs.

 

I have to export all that data (already done with dataextraction)to excel.

 

option 1:

Since the goal to achieve is a Room Data sheet, I also need areas and permieters. So the question is: how can I implement that function into an existing and populated block?

 

option 2:

Otherwise, it would be useful to obtain the ObjectID of an external Polyline.

If I knew how to do that, y think I could manage to solve the problem.

 

option 3:

Is there any way of building a block that contains a polyline inside, which can be eddited (not only stretched) as a block attribute without entering the block editor?

If so, i could manage a FIELD formula to extract the area from that specific polyline, which must be unique (and not repeated through the other block instances)

 

Tnaks a lot!

regards,

 

Matias

Link to comment
Share on other sites

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