Quantcast
Channel: Autodesk India Community aggregator
Viewing all 1680 articles
Browse latest View live

AutoCAD Customization: .NET: Dynamic block component

$
0
0

Hi All,

 

Is there any way to get all displayed object(attribute and text) of the dynamic block. Please see attachment.

 

Thanks for help.


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Problem insert block which attributes cad 2014

$
0
0

Hello again¡¡¡

 

I am testing de new version of autocad 2014 and i have a problem which me lips.

 

when i use

(command "_insert" "block1" pt1 "" "" ""  obj1 )

The block is inserted but without value. In the old version work.Some variable that has to change?

 

Sorry for my english.

 

 

 

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Ribbon button image won't repopulate after modifying bitmap image

$
0
0

I am updating my CUI ribbon for some of my customized buttons.  I have changed some of the bitmap images that I have saved in my network folder for the network AutoCAD customization.  However, I cannot get the Ribbon to update to show the new button images.  

 

I have opened the CUI, browsed down to the partial CUI for our corporate configuration, then to the "Ribbon", then to the "Tabs", then to the individual section of the tab and clicked on it.  Then I click on the specific button in the "Panel Preview" pane to get the properties for that button to show.  Then at the bottom of the "Properties" panel, I click on the "Small Image" line to see the three dots that allow you to browse to where the .bmp is stored.  I have not renamed the bitmaps, but just modified their color and the way they look.  So I have to change the .bmp file to a different location in the small image properties, then change it back to the correct image name.  It will update the appearance in the "Panel Preview", but will not update the actual ribbon.  I click on "Apply" and "OK", and it still doesn't update the actual ribbon.  I have tried closing and restarting AutoCAD after that, but that didn't help.  As a last resort, I rebooted to see if that would complete the change, but that did not help either.

 

I made sure that the network location for the bitmap files is listed in my Options > Support File Search Path (very near the top of the support file list), but that still isn't solving the problem.

 

Any thoughts on how to get AutoCAD to completely forget the old image that is showing on the ribbon and repopulate it with the updated bitmap image?

 

The strange thing is that one image actually did stay updated while the others will not.  (Very weird) :smileyfrustrated:

 

Thanks in advance for your help.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Search for existing MLeader wtih attribute value.

$
0
0

Hi all,

 

I'm working out a LISP for searching my entire drawing for a MLeader with a given value and then do something if it is found.

 

Currently, my code dies with 

 

; error: Automation Error. Description was not provided.

 

I do not know what is going wrong & I don't know what must be done next.

 

(DEFUN ML-SRCHSTR (TXT LBL / SS n_txt_LBL ENT P1 P2) ;|(ML-SRCHSTR TXT)|;
  (IF (SSGET "x" '((0 . "MULTILEADER")))
    (PROGN
      (SETQ ss (VLA-GET-ACTIVESELECTIONSET (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))))
      (VLAX-FOR	ent ss
	(IF (VL-STRING-SEARCH txt (STRCASE (VLA-GET-TEXTSTRING ent)))
	  (PROGN
	    (VLA-CLEAR ss)
	    (INITGET 1 "Yes No")
	    (SETQ n_txt_LBL (STRCAT "\n\t =>> " LBL " Label EXISTS! Add another " txt "? ")
		  y_n	    (GETKWORD (strcat n_txt_LBL " [Yes/No]: "))
	    )
	    (IF	(= y_n "Yes")
	      (PROGN (ppa-L-PLANTXT)
		     (VL-CMDF "cmleaderstyle" "LandscapeQua")
		     (INITGET 1)
		     (SETQ P1 (GETPOINT "\n\t =>> Specify leader start point: ")
			   P2 (GETPOINT P1 "\n\t =>> Specify next point: ")
		     )
		     (VL-CMDF "_.mleader" P1 P2 txt)
	      )
	    )
	  )
	)
      )
      (IF (> (VLA-GET-COUNT ss) 0)
	(PROGN (ppa-L-PLANTXT)
	       (VL-CMDF "cmleaderstyle" "LandscapeQua")
	       (INITGET 1)
	       (SETQ P1	(GETPOINT "\n\t =>> Specify leader start point: ")
		     P2	(GETPOINT P1 "\n\t =>> Specify next point: ")
	       )
	       (VL-CMDF "_.mleader" P1 P2 txt)
	)
      )
    )
    (PROGN (ppa-L-PLANTXT)
	   (VL-CMDF "cmleaderstyle" "LandscapeQua")
	   (INITGET 1)
	   (SETQ P1 (GETPOINT "\n\t =>> Specify leader start point: ")
		 P2 (GETPOINT P1 "\n\t =>> Specify next point: ")
	   )
	   (VL-CMDF "_.mleader" P1 P2 txt)
    )
  )
)

 FYI - (ppa-L-PLANTXT) only sets my current layer.

 

My MLeader has a _TagBox & it is the attribute of the _TagBox that I am trying to check/compare the "txt" value.

 

Any help is greatly appreciated.

AutoCAD Customization: .NET: How to cancel a order before use .net API?

$
0
0

I know the way to sendCommand to AutoCAD will cancel one order . I mean is there any other way to use .net API to cancel  one order but not using 'SendCommand'

AutoCAD Customization: .NET: How Can I Get All Block Attributes and change it

$
0
0

hi every one

 

How Can I Get All Block Attributes and change it

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: AutoCAD API Wishlist Survey 2013

$
0
0

It is my pleasure to announce the launch of the AutoCAD API wishlist survey for 2013. I hope you’ll be willing to give 5-10 minutes of your time to take the survey – the results will be used to guide the efforts of our engineering team.

 

Click here to take survey

 

The survey will remain open until 21st of June 2013.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: LISP: Clear Previous Plot

$
0
0

Anyone have a LISP routine that clears the 'previous plot' settings?

 


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: find string # matches

$
0
0

Hello,

I'm looking for a lisp routine that will draw a line between all matching numbers that are repeated 3 times or more in a selection.

I'm using AutoCad 2012.

thanks

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: error in while command

$
0
0

Sorry for being one of those first post people.  I did search around a little but didn't come across it. 

 

We have a lisp routine that I co-authored ages ago and then haven't done much programming in about 7 years.  I seem to have forgotten much of my language skills.  This portion of the lisp routine was running fine in autocad 2005 which is what the computer had on it, and it doesn't run on autocad 2010.  I've narrowed it down to the while statement which is why you see it commented out, but that portion is necessary.   My main question is was there a change in the language specifically the while statement between 2005 and 2010?  If not can someone give me a little guidance as to why my error is occuring?  Thanks in advance

 

    ;         GET LINES OVER 10" AND THROW OUT                          
      
      (if (= (cdr(assoc 0 outerinfo)) "LWPOLYLINE")
	  	(progn
        	(setq remlenouter 0.0)
        	(setq numseg (cdr(assoc 90 outerinfo)))
		    (setq edd (member(assoc 10 outerinfo) outerinfo))
        	(setq n1 0)
     
       			;(while (< n1 (- (* numseg 4) 4))
         			;(setq dist   (distance (cdr(nth n1 edd)) (cdr(nth (+ n1 4) edd))))
         			;(if (>= dist edmmax) (setq remlenouter (+ remlenouter dist)))
	 			;(setq n1 (+ n1 4))
       			;) ; end while
	        (setq dist   (distance (cdr(nth n1 edd)) (cdr(nth 0 edd))))
         	(if (>= dist edmmax) (setq remlenouter (+ remlenouter dist)))
	    ) ; end progn
       ) ; END IF

 

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Text to Geometry Lisp code needed, please assist me!

$
0
0

Hello everybody.  I am new to the forums so I hope this is in the correct directory...

 

Ok, so I have been searching forever it seems to get an efficient conversion tool to replicate TXTEXP. After careful study of the forums and trying combinations of such tips, I've come up with a string of commands... I need help on turning this string into a LISP routine for job use. Having a LISP will save us considerable drawing time even in this condensed form~

The commands are this:

 

- The code is enacted with a wide text (Arial for example) in model space -

- start lisp routine with rectangular window selection only -

ZOOM OBJECT {PAUSE FOR SELECTION} ; (==STORE COORDINATES==)

CMDECHO 0; DISABLES COMMAND READOUT TO PREVENT CMD LINE CLUTTER
COPY P  0,0 0;   MAKES DUPLICATE OF THE SELECTED OBJECT
TXTEXP P ;   INITIATE EXPLODE
ZOOM P;    RESTORE CAMERA POSITION
REGION P UNION ; (==RECALL COORDINATES FOR UNION AND ONLY SELECT REGIONS==) *
EXPLODE P CMDECHO 1;  CONVERT TO POLYLINES, RESTORE SYS VARIABLE AND END SCRIPT
<start closing note here with blank line>
\nThe selected text has been exploded.
\nDouble check the oulines of any number 4 in the selected set.
{end lisp routine}

 

I am novice still at writing LISP routines, and have modified several, but have never been able to figure out coordinate storage or multiple command lisps such as this (which this code calls Previous selection /and/ coordinate sets often).

 

Thank you for any assistance on this!

 

 

Ken

AutoCAD Customization: .NET: If selected entity xdata contains value Then select additional entity

$
0
0

Hi,

I would like to add additional entities to the selection if any of the selected entities contains a an xdata value.

If I put the condition into the ImpliedSelectionChanged reactor I imagine will probably loop back on itself.

Is this something that might be possible?

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Convert a list with string or lists of strings to text

$
0
0

Someday the light bulb is going off and I will understand mapcar and lambda.

However.....

 

I have a program that reads an excel file sheets. Sometimes the sheet only has 1 column, sometimes 2 or more.

I need to convert the saved values from the sheet to a list with the text spaced evenly.

Unfortunately the text lengths vary.

I would like a subroutine to pass the list to and return a list of strings with text aligned with padded spaces allowing for the longest text in each column.

I am using the new list in a dialog box with fixed_width_font=true (so columns align).

I hope this is clearer than mud!

 

Example 1-

(setq List1 (list "Col1-Line1""Col1-Line2""Col1-Line3-longer""Col1-Line4"))

(AlignText List1)

returns

"Col1-Line1"

"Col1-Line2"

"Col1-Line3-longer"

"Col1-Line4"

so no padding needed

 

Example 2 -

(setq List2 (list (list "Col1-Line1""Col1-Line2""Col1-Line3-longer""Col1-Line4") (list "Col2-Line1-longer""Col2-Line2""Col1-Line3""Col2-Line4")))

(AlignText List1)

returns

"Col1-Line1        Col2-Line1-longer"

"Col1-Line2        Col2-Line2       "

"Col1-Line3-longer Col2-Line3      "

"Col1-Line4        Col2-Line4      "

 

 Example 3 -

(setq List3 (list (list "Col1-Line1""Col1-Line2-longer""Col1-Line3""Col1-Line4") (list "Col2-Line1-longer""Col2-Line2""Col1-Line3""Col2-Line4") (list "Col3-Line1-longer""Col3-Line2""Col1-Line3""Col3-Line4")))

 

returns

"Col1-Line1        Col2-Line1-longer Col3-Line1-longer"

"Col1-Line2-longer Col2-Line2       Col3-Line2       "

"Col1-Line3-longer Col2-Line3      Col1-Line3       "

"Col1-Line4        Col2-Line4      Col3-Line4       "

 

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: verify a (block by name) is or is not the last entity added to drawing.

$
0
0

Hi all,

 

I needed a sub-function that I could call with a blockname as an argument and get back a response of T or nil to verify if the blockname is or is not the last entity added to the drawing.

 

After texting different approaches I got it working like this:

 

(defun IsBlkLast (blkNm) (IF (= (CDR (ASSOC 2 (ENTGET (ENTLAST)))) blkNm) T NIL))

 I tried using:

 

(defun IsBlkLast (blkNm) (IF (= (VLA-GET-EFFECTIVENAME (VLAX-ENAME->VLA-OBJECT (ENTLAST))) blkNm) T NIL))

 But, for whatever reason beyond my understanding, it only worked while part of a longer function and only failed when called as a sub-function.

 

I'm just curious if anyone can shed some light on this for me. I suppose it wouldn't much matter, but I was hoping to use this universally for standard blocks as well as for dynamic blocks.

 

Thank you.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: CLOSE .LSP

$
0
0

Hi, I am trying to make a close .lsp command, I keep getting this error:

 

           ;error: no function definition: RMA_SAVE

 

in my .lsp everything looks like its inputed correctly:

 

         (defun C:CC     () (command "CLOSE"))

 

Any help would be greatly appreciated.


AutoCAD Customization: .NET: RotatedDimension TextPosition changed after transaction commit

$
0
0

I'm having a problem with RotatedDimension. I'm initializing it with some values and after I commit the transaction the value of TextPosition is changed. Any ideas why this is happening?

 

 

            using (var transaction = parentDoc.GetNewTransaction())
            {
		var rotatedDimension = new RotatedDimension();
		// ...
                rotatedDimension.TextPosition = textPosition.ToArxPoint3d();
                parentBtr.AppendEntity(rotatedDimension);
                transaction.AddNewlyCreatedDBObject(rotatedDimension, true);
                transaction.Commit();
            }
            return rotatedDimension;

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Different DWG Version Icons in Windows Explorer

$
0
0

Back in the day, there was an applicaton that showed the drawing version # in the icon in windows explorer.  That was good for then, because of the lack of object data in many of the verticles.  The link I have isn't valid anymore and it didn't work in Win7.  

 

What I'd like to have is something that will show the different Acad versions related to the icon using the product ID, for example:

ACAD-5xxx = 2007 

ACAD-6xxx = 2008

ACAD-7xxx = 2009

ACAD-8xxx = 2010

ACAD-9xxx = 2011

then in 2012 they changed to Axxx

2013 = Bxxx (???) I dont' have 2013 loaded

2014 = Dxxx (what happened to Cxxx?)

 

With the lack of backward compatability between versions for objects (and I totally get that), it would be nice to be able to tell by an icon which version was used to create the drawing.  I know the version informaton is stored in the header, which can be read, I'm just not a programmer.  I proposed this idea a while back, but I forget who I talked to, sorry if you're reading this.

 

Anyone else think this would be useful?  

 

AutoCAD Customization: .NET: processing drawings w/o opening them - no time improvment

$
0
0

I modified a routine that processed xref names & paths w/in a set of folders. Thie original version would open each drawing & do its thing. THis would take about 20 minutes (aprroximately 90 files). I modified it to work w/o opening each drawing. This still takes about 20 minutes.

 

I would have though that not avtually opeing each drawing would dramitically decrease the overall time required to run this routine.

 

anyone have any insight to this?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: new more help

$
0
0

I have asked this before and I have done a bunch of research to try to find the answer, but I haven't gotten anywhere.  I wrote a program, that loops through a blocks attributes, and if it finds a specific Attribute Tag (2. ???).  pull out the attribute value (1.  ??).  In 99% of my drawings I will need to pull out 3 tags(TAG1, DESC1, DESC2).  My routine involves me copying the value of DESC1 into TAG1, and then copying DESC2 into DESC1.  I thought it would be simple to write a lisp (And I am still trying to learn lisp) just type in a command, then click the block and the attributes will fix themselves.  But its not working, and therefore I am stuck.  Any help would be awesome.  I can attach my code if anyone wants to look at it

 

Thanks to anyone who walks me through it...

AutoCAD Customization: .NET: VB/Map 3D - Reading Object Data tables from dwg in side database

$
0
0

Hello All,

 

Would you have a solution to accessing ODTables for a dwg object only loaded into memory? I have 1000+ dwgs that I want to return a string with the names of the various ODTable names for auding purposes that I would prefer to just side load rather than full load for performance reasons.

 

 I'm attempting to use something like this (which works fine on an open drawing):

==================================

 Public Function ReturnOBJData(acObjIDIn As ObjectId, intOffset As IntegerAs String    'Don't forget that table is 0 based offset so....plan accordingly    Dim strRet As String = ""    Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
    Dim acDb As Database = acDoc.Database
    Dim acEd As Editor = acDoc.Editor
 
    Dim acMapApp As MapApplication = HostMapApplicationServices.Application
    Dim acActiveProject As Project.ProjectModel = acMapApp.ActiveProject
    Dim acTableList As Tables = acActiveProject.ODTables
    Dim acTable As ObjectData.Table    Dim acRecs As ObjectData.Records    Dim acRec As ObjectData.Record    Dim acVal As Autodesk.Gis.Map.Utilities.MapValue    Dim acEnt As Entity    Using actrans As Transaction = acDb.TransactionManager.StartTransaction
      acEnt = actrans.GetObject(acObjIDIn, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
      Try        acTable = acTableList("Parcels")
        acRecs = acTable.GetObjectTableRecords(0, acObjIDIn, Autodesk.Gis.Map.Constants.OpenMode.OpenForRead, True)
        acRec = acRecs.Item(0)
        'We should have the record so return the value        acVal = acRec(intOffset)
        Select Case acVal.Type
          Case Autodesk.Gis.Map.Constants.DataType.Character
            strRet = acVal.StrValue
          Case Autodesk.Gis.Map.Constants.DataType.Integer
            strRet = acVal.Int32Value.ToString
        End Select      Catch ex As System.Exception      End Try    End Using    'Clean up and dispose    Return strRet
  End Function

==============================

In a fashion along the lines of

==============================
 Public Function GetTables(strFileIn As StringAs List(Of String)
    Dim lstReturn As New List(Of String)
    Dim acMapApp As MapApplication = HostMapApplicationServices.Application
    Dim acActiveProject As Project.ProjectModel = acMapApp.ActiveProject
    Dim acTableList As Tables = acActiveProject.ODTables
    Dim acTable As ObjectData.Table    Try      Using acDb As New Database(FalseTrue)
        'Just work with dwg in memory rather than displaying it        acDb.ReadDwgFile(strFileIn, FileOpenMode.OpenForReadAndAllShare, False"")
        acDb.CloseInput(True)
        Using actrans As Transaction = acDb.TransactionManager.StartTransaction
          MsgBox(acTableList.TablesCount)
        End Using      End Using    Catch ex As System.Exception      MsgBox(ex.ToString, , "Problem Getting Tables")     End Try    Return lstReturn   End Function

================================

The problem is that I can't seem to link the ODTables object off of the memory database object. In this sample, the msgbox always returns a count of 0 where I would expect it to be in the range of 1-4.

Any pointers would be greatly appreciated

Regards,

Tom
Viewing all 1680 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>