Jump to content

script problem: blank space in file path


lacciap

Recommended Posts

Lee, just to be on the safe side ... I'd advise you to change the Vanilla Lisp SetAttribute function to not use the entire DXF list when doing the entupd - may cause problems with annotative scales. Rather change the internal of the while loop to this:
   (if (eq tag (cdr (assoc 2 elist)))
     (progn
       (entupd
         [color=red][b](list
           (assoc -1 elist)
           (cons 1 value)
         )[/b][/color]
       )
       (setq done value)
     )
   )

 

I'll admit, I haven't come across that issue, but then I haven't used annotative scales...

 

Thanks for the suggestion Irneb, I really appreciate you taking the time to look over my code.

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • lacciap

    11

  • Lee Mac

    8

  • irneb

    7

  • fixo

    3

Top Posters In This Topic

   (if (eq tag (cdr (assoc 2 elist)))
     (progn
       (entupd
         [color=red][b](list
           (assoc -1 elist)
           (cons 1 value)
         )[/b][/color]
       )
       (setq done value)
     )
   )

 

I didn't realise you could modify an entity in that way, without using entmod -learn something new everyday :)

Link to comment
Share on other sites

I didn't realise you could modify an entity in that way, without using entmod -learn something new everyday :)
Yep, entmod only needs the ename and the codes which need to change. No need to send it all the data if only a small amount of it is changing. I've even shown how this method makes entmod more efficient (getting to the same speeds as when doing it through vla), on a test which RK McSwain did. See post #42 in this thread on AUGI - and the link to RK's blog.
Link to comment
Share on other sites

I didn't realise you could modify an entity in that way, without using entmod -learn something new everyday :)
Sorry, mistype - you still need entmod, just not the subst portion. :oops:
Link to comment
Share on other sites

Sorry, mistype - you still need entmod, just not the subst portion. :oops:
So my modification should have show like this instead:
    (if (eq tag (cdr (assoc 2 elist)))
     (progn
       (entupd
         (cdr
           (assoc -1
             (entmod
               [b][color=red](list (assoc -1 elist) (cons 1 value))[/color][/b]
             )
           )
         )
       )
       (setq done value)
     )
   )

Link to comment
Share on other sites

So my modification should have show like this instead

 

I see - thanks Irneb :)

 

So, if I understand it correctly: when updating the entity DXF data in the drawing database, entmod automatically performs the substitution of pairs, changing those which appear in the DXF list provided to it. Hence explaining why this method is faster, as only those pairs which need to be changed are substituted, whereas in my previous code, all pairs were substituted everytime.

 

Am I somewhere near in my understanding?

Link to comment
Share on other sites

Firstly, the DotNet method would be something where you create a specific command, compiled into a DLL. It would not be a script in itself, but could probably be called from a script. This is the major reason most use Lisp instead, it's a quick-fix general purpose way of making an intelligent script. The overhead of doing a DotNet DLL each time you have something strange to fix in multiple DWGs makes most avoid it.

 

I'd say if you're going to do a lot of these things, it's probably a good idea to get at least a basic understanding of lisp. And you have posted this into the lisp forum, so ... that's probably the language of choice over here. Anyway, there should be numerous examples of getting hold of blocks & their attributes in these (and other) forums - I'd even venture to say this place may be positively riddled with them. Just do a search in this forum for BLOCK ATTRIBUTE MODIFY ... there's should be quite a few samples (56 threads at present), from which you may be able to adjust one to your exact needs.

 

The major reason that lisp is "easy" to use in this case - it can be typed directly into the command line. Thus it can be copied into the SCR file as well - it's then as if you typed those keys into ACad's command line. The draw-backs of lisp are:

It can't natively work with multiple drawings in sequence / at once. For that you require something else to open & close DWGs and then call the lisp. That's why the ScriptPro / AutoScript - there's other ways as well, but that's the easiest for the novice. And IMO works the best, or at least well enough for me.

You don't have all the capabilities you'd have gotten through using DotNet / ARX. But you get all the capabilities you'd have been able to with VBA ... and then some - just the previous point applies here as compared to VBA.

It would be a bit slower running than DotNet / ARX, but usually your code would be so small that loading the DLL / ARX file would negate the speed benefit.

 

thank you very much for your detailed exposition irneb and for time you spent for me. And thank you Lee Mac for your lisp codes.

I've fixed some point. First of all I handle the way to use COM Interop and get an instance of acad.exe from my batch process. ay least it's a good start! :)

I've tried to follow the API .NET method to work with documents and objects but I've got some trouble to do it. if I understood .NET API are built for inside process as I red in this good article

http://through-the-interface.typepad.com/through_the_interface/2007/12/launching-autoc.html

but I was trying to use the api classes from 'outside' acad.

 

anyway for the first step of my project I'll use dwg files with single block and I've seen i can set all the attributes just using _INSERT scr command.

For the next step I'm still a bit confused. I mean, I don't know if I'll try to go deeper with .NET API 'couse it seems a really powerful instrument to make acad customization. isn'it? Or maybe I will go deeper with lisp and I will make 'smarter' script capables to edit blocks from a multiple blocks dwg.

Don't know.

Do you suggest me the LISP direction in any case?

 

Many thank!

Link to comment
Share on other sites

Am I somewhere near in my understanding?
You've got it! Just as changing an ActiveX object's property only sends the needed data to the object, entmod only needs the actual modified data (and the ename to know where to apply it).

 

Don't know.

Do you suggest me the LISP direction in any case?

 

Many thank!

You're welcome. I would not presume to tell you what to use. Here's a thread which shows you many of the benefits and pitfalls between all the ways you can customize ACad. I'd say there's no one clear concise answer. Each method has its uses, and each use has one or more "preferred" methods. Which you use is more a question of your situation that what is the "best", or most fashionable, or even "easiest" to learn.

 

But, as I've mentioned before: it won't do you any harm to at least get a grasp of lisp ... if only so you can figure out which portions to copy-n-paste into where. It would be beneficial in any situation (even if you're going to use DotNet exclusively), since you'll be able to re-use others' code and not have to do everything yourself.

Link to comment
Share on other sites

You're welcome. I would not presume to tell you what to use. Here's a thread which shows you many of the benefits and pitfalls between all the ways you can customize ACad. I'd say there's no one clear concise answer. Each method has its uses, and each use has one or more "preferred" methods. Which you use is more a question of your situation that what is the "best", or most fashionable, or even "easiest" to learn.

 

But, as I've mentioned before: it won't do you any harm to at least get a grasp of lisp ... if only so you can figure out which portions to copy-n-paste into where. It would be beneficial in any situation (even if you're going to use DotNet exclusively), since you'll be able to re-use others' code and not have to do everything yourself.

 

Thanks again irneb. I'll definitively start with lisp!

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