Jump to content

Recommended Posts

Posted

Hi All

 

This is a general question regarding a choice of new language I want to learn.

I'm considering VB.NET or VBA

The reason I want to learn a new one is because I've been told Lisp has its limitations and isn't well supported any more by Autodesk.

I know VB.NET will do pretty much everything I want.

But will VBA be enough? 

Is VBA likely to continue as popular language?

 

Regards

 

Tony

Posted

If you a re talking strictly AutoCAD based programming languages:

  • Common lisp is one the oldest languages a round
  • AutoLSP (AutoCADs version of common LISP)   has been around 25+ years.  It is not going anywhere unless AutoDESK looses a few more brain cells.  Bricscad is doing a nice job of developing their lisp interface
  • Visual LSP is going on 15-20 years and has some enhanced functions and like Vanilla AutoLISP,  it is no addtional cost incorporated into plain AutoCAD
  • I thought VB had been abandoned a good while ago as a legacy language
  • Vanilla AutoLISP in conjunction with DOSLIB functions can preform the vast majority of customization needs that I see requests for.  It's more about  programmer's skills and knowledge than the language's limitations

Various languages can be compiled to run in AutoCAD as EXE EXP ARX but they are VERY complex and historically have had to been recompiled regularly

 

HTML5 may 1 day be thing .  Who knows !  C+ F Maybe !

 

My advice is to learn and be proficient in a simple language .  And then try an advanced 1 if you need to.

 

-David

  • Like 2
Posted

Hi Tony,
Don't get me wrong, but you don't seem to have enough experience. Where experience != knowledge.
Judging by your requests from your posts, all of them can be done with AutoLISP.
Here are two examples to create a simple line -
 

AutoLISP :

(setq p1 '(5. 5. 0))
(setq p2 '(12. 3. 0.))
(entmakex (cons '(0 . "LINE") (mapcar 'cons '(10 11) (list p1 p2))))

 

C# (.NET)  /source/ :

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

[CommandMethod("AddLine")]
public static void AddLine()
{
  // Get the current document and database
  Document acDoc = Application.DocumentManager.MdiActiveDocument;
  Database acCurDb = acDoc.Database;
  
  // Start a transaction
  using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
  {
    // Open the Block table for read
    BlockTable acBlkTbl;
    acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,
    OpenMode.ForRead) as BlockTable;
    
    // Open the Block table record Model space for write
    BlockTableRecord acBlkTblRec;
    acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],
    OpenMode.ForWrite) as BlockTableRecord;
    
    // Create a line that starts at 5,5 and ends at 12,3
    using (Line acLine = new Line(new Point3d(5, 5, 0),
    new Point3d(12, 3, 0)))
    {
      
      // Add the new object to the block table record and the transaction
      acBlkTblRec.AppendEntity(acLine);
      acTrans.AddNewlyCreatedDBObject(acLine, true);
    }
    
    // Save the new object to the database
    acTrans.Commit();
  }
}

Its true that AutoLISP is limited (although I don't know by how much and at which aspects), but as you can see its alot simplier to use, shorter and easier to maintain.

I only know one huge drawback that is within the DCL dialogs (not enough event handlers for the tiles/controls.. like mouse_hover / mouse_leave ), so you can't be that fancy in there.

But as long you get the job done, who cares ?

 

I have this real-life friend that brags about learning the powerful language C#, but also null experience (and doesn't seem that he's about to sit and write some actual code).

So when I ask, 

Q: Ok so what you are able to do with it?

A: IDK, but I've heard many things can be done in C#

Q: Check out this TicTacToe code I wrote in C#

A: Sorry, but I don't understand it and I get lost at it (reason is because when one doesn't practice, isn't able to follow any code's algorithm)

 

So the answer is short - open up that Notepad++/VLIDE/Visual Studio and start to practice, so you'll build your own opinion (and it will change quite few times).

  • Like 3
Posted

Thanks Grr & David

 

I'm trying to establish weather the things I want to do in Autocad can be done in lisp. I use a program called Advance Steel and there are many enhancements I can think of to improve productivity. A lot of the enhancements are working in Model space on the 3D solid steel members that are created by Advance Steel. Can Lisp be used to access information about the properties of such members. 

 

As an example I want to label the end of a 3D steel member in Model space to show it's Weight and Mark Number. Because we are constantly changing the position we view the steel member from we would always want the label showing square to the screen and not oriented to the steel member. This particular Application would also need to be turned on and off as required. There would need to be a choice of member properties to choose from. Not just Weight and Mark Number.

 

Is this something that could be done in AutoLisp???

 

Regards

 

Tony

 

 

Posted
1 hour ago, TunzaGibbo said:

Can Lisp be used to access information about the properties of such members. 

 

Yes if they are COM based. But first things first, have you checked Advance Steel's SDK ?

 

1 hour ago, TunzaGibbo said:

As an example I want to label the end of a 3D steel member in Model space to show it's Weight and Mark Number. Because we are constantly changing the position we view the steel member from we would always want the label showing square to the screen and not oriented to the steel member. This particular Application would also need to be turned on and off as required. There would need to be a choice of member properties to choose from. Not just Weight and Mark Number.

 

Now that you figured out the concept of your program (as an user), now break it down into logical steps that need to be followed, for instance:

  When my program is turned on:

    On a selection:

      Use a list to obtain all the properties

      Display a modal/modeless dialog

      The dialog will contain X controls/tiles

      Fill the certain control to display the properties

      From the selection user's made, extract these certain properties

      .. do whatever you intend to do with the selection.

Then these steps need to be breaked into subfunctions, some of them you may find on internet, others you must figure out by yourself.

 

Apologies if you already know the above, but do you have any experience about writing programs on your own? (in any language)

if not then read this:

Because I don't think the plan to turn yourself from zero to hero will work, for instance check the work of this and this  guy.

Now go to the 578'th page of the AutoLISP section on cadtutor, to check out what guys like them were doing back in the time.

If you still don't get it, I'll tell you - they started very simple and they were coding like hell some programs on their level.

With the time if you check code after code they posted and what questions they ask you may realize that they leveled-up bit by bit.

Hence work like this doesn't appear out of nowhere.

BTW I still learn from them - because its not just the codes you can learn from, you can learn from the people themselves, their questions, their background...

 

I mentioned you my RL friend with his cool programming language C#, and he has big ambitions just like you..

although while he's unable to grasp the concept of programming, so he'll be stuck at the Console.WriteLine / ReadLine and some string-handling stuff,

while guys like Lee or Tharwat even though don't use such language, still can easily outdo him if they decide to make a language switch.

So its not the language's fault its the programmer's perception -

you may have a guy with a big potential and a limited language to create outstanding work

and you may have a guy with no potential and a powerful language to be able to print some text into the console or write some text onto a file.

 

I'm telling you all of this, because I think you are on the wrong track, you should start with something very simple and grow..

and keep ideas like the one you wrote in your pocked till you gain the skills to implement it into a complete program.

 

 Good night from my place. :sleeping: 💤

 

 

Posted

Thank you for your comments. I always listen and learn.

I have written around 80 to 90 lisp programs which I use everyday and so do about 70 other people who use Advance Steel. All these programs I have written are used in the 2D environment of Advance Steel (Paper Space). Mainly for editing computer generated drawings and manually generated General Arrangement Drawings. We have now come to the point where we don't need any more productivity tools for editing 2D drawings and need to move into productivity tools for the 3D Solid Modelling Environment. A typical example of one of these tools was described in my last post. Some more that I need a more complicated than that one. 

So my question still stands: Has Autolisp got the ability to delve into the drawing database and extract the required information via dialogue box or keyboard input and then produce a result on the screen?

I have no doubt that I have the ability to make all this happen. I just don't know what language to use.

My choices as I see them are:

Stay with Lisp (If it has the capabilities) and advance my knowledge. This would be my preferred choice.

VB for Applications (VBA) I would have to learn from scratch. (This one has the capabilities)

VB.NET is much harder to learn than the above and  I would have to learn from scratch as well. (This one has the capabilities)

 

Regards

 

Tony

Posted

When you Google Advance Steel and lisp did you find anything this has been asked before, I am pretty sure you can get into some of the entities using xdata methods. 

Posted

Thanks Bigal

There is information describing the use of Active X and Object ARX with Visual Lisp But there doesn't appear to be info on what can be achieved by these methods. I was hoping this forum might have someone who knows about what I'm trying to achieve. It's difficult to contact anyone from Autodesk

 

Regards.

Posted

Pertinent thread regarding AutoCAD development, at least:

 

 

Posted (edited)

Autodesk will not give an answer as Advance steel is a 3rd party developed software using Autocad or another Briscad etc as its engine for drafting.

 

Its the same for every lisp posted here Autodesk will not tell you how to use code by Lee-mac Tharwat, Maratovich etc to mention a few

 

There is definately posts here about getting into Advanced steel as I dont use it I have not searched, you really need to do that ! 

 

What exactly is it your trying to do ?

 

This took seconds https://knowledge.autodesk.com/support/advance-steel/troubleshooting/caas/sfdcarticles/sfdcarticles/Advance-Steel-Documentation-about-LISP-for-Advance-Steel-product.html

 

 

 

Edited by BIGAL
Posted

Thanks Bigal

Advance Steel was 3rd party software but is now owned by Autodesk. Previously you needed to buy Autocad and Advance Steel as an Addon.Tthis was when Advance Steel was owned by Graitec in France. Ita now sold as just Advance Steel.

 

This is an example of what I want to acheive:

I want to label the end of a 3D steel member in Model space to show it's Weight and Mark Number. Because we are constantly changing the position we view the steel member from we would always want the label showing square to the screen and not oriented to the steel member. (See the 2 attachments) This particular Application would also need to be turned on and off as required. There would need to be a choice of member properties to choose from. Such as the members Model Role, Grade of Steel etc. Not just Weight and Mark Number.

 

Regards

Labelling_Solids.png

Labelling_Solids.png

Posted

Thats 2 questions still pretty sure that search here, getting properties of the beam was possible.

 

The labeling would be done by flipping to ucs world not sure about a field for those properties. What happens when you use Mtext and fields.

 

Need a sample dwg for any one here to have a look.

Posted

Thanks again

The solid members created in Advance Steel won't work in Autocad. I need to convert them to Autocad solids. The only problem is that the properties of the Advance Steel member will be lost in the conversion. However in saying that getting the text to work correctly should still be much the same.

I guess I could have an attributed block that inserts and this block could have the choice of showing certain attributes. The attributes would have to relate to the Advance Steel member properties.

 

I can send a sample of the beams as Autocad solids but do you think that through Autolisp the Advance Steel member properties can be accessed.

 

Tony 

 

Posted (edited)

Post Advanced steel dwg need to have something to play with.

 

Pick object using this code, should reveal properties.

 

(defun C:DumpIt ( / ent) 
  (while (setq ent (entsel)) 
    (vlax-Dump-Object 
      (vlax-Ename->Vla-Object (car ent)) 
    ) 
  ) 
  (princ) 
)

(c:dumpit)

Edited by BIGAL
Posted

Hi Bigal

The drawing I have included is from Advance Steel 2019

This is what I got from "DumpIt" from that same drawing

 

Command: DUMPIT

Select object: ; IAcadEntity: AutoCAD Entity Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff6ff966558>
;   Document (RO) = #<VLA-OBJECT IAcadDocument 0000010edd37ecf8>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "2418"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000010f48b1e648>
;   Layer = "Beams"
;   Linetype = "ByLayer"
;   LinetypeScale = 20.0
;   Lineweight = -1
;   Material = "ByLayer"
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AstBeamRepr"
;   OwnerID (RO) = 43
;   PlotStyleName = "ByLayer"
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000010f3a9f

Sample Beam.dwg

  • 2 years later...
Posted

Hi TunzaGibbo,

 

did you find a solution for your task? What is your experience with LISP in Advance Steel? Is there any www / forum with LISP for Advance steel? I'm also trying to implement it somehow, but I can't find any help.

 

Many thanks in advance

 

Posted

Karel: If you visit the Advance Steel forum and search on the word "lisp" you will find roughly 85 questions regarding the topic.  There is no separate subforum for lisp in the Advance Steel forum itself.

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