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

AutoCAD Customization: .NET: .net form to change dynamic blocks

$
0
0

Hi, I am new to .net customization but I would like to know if the following is possible.

 

I need to build a form web site that contains a series of drop down lists.

I have a lot of drawings that are basically section details, each one containing a dynamic block with 2-3 different visibility parameters.

 

My program should identify the drawings based on user selection and modify each dynamic block as required by the user data, then print each layout and produce a single multipage as a PDF.

 

This is the short version and I would like to know if it is possible in .net, and if anyone is willing to help.

 

Thank you.


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: IS IT POSSIBLE AUTOCAD TO EXCEL

$
0
0

(DEFUN C:VGJ()

(SETQ

OBJ(CAR(ENTSEL))

VOBJ(VLAX-ENAME->VLA-OBJECT OBJ)

LA(VLA-GET-TEXTSTRING VOBJ)

TE "ST 64P"

WC "WC 45"

)

(IF(= LA TE)

(PROGN

 

(vla-put-TextString VOBJ "Smeralda calacutta marble polished finish 140mm high with 10mm shadow gap")

 

)

(IF(= LA WC)

(PROGN

 

(vla-put-TextString VOBJ "Fabric wrapped wall panels")


)

 



(alert "PLSE SEARCH THE FILE")

)

 

))

 

 

 

i create the program for BOQ . I WANT I ENTER THE STRING (GETSTRING :"\n ENTER NAME OF MATERIAL:"  ST 64P) ITS WILL BE SEARCH IN EXCEL FILE  AND TAKE THE MATERIAL NAME IN EXCEL AND CHANGE THE TEXT IN AUTOCAD FROM NAME OF   MATERIAL  IN EXCEL.



 

AutoCAD Customization: Visual Basic Customization: Running Autolisp command from VBA does not work!!

$
0
0

I have a lisp routine to count blocks and it works just fine. I load it and type "countblock" or "(c:countblock)".

 

I want to run it in VBA (2010) but the code does not work. What am I missing?

 

Public Sub DrawToScreen2()
Dim strGRVECS As String
Dim objVL As Object
Dim objVLF As Object
Dim objVLO As Object
Dim varReturned As Variant
Set objVL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
Set objVLF = objVL.ActiveDocument.Functions
Set objVLO = objVLF.Item("read").funcall("(C:BlockCount)")
varReturned = objVLF.Item("eval").funcall(objVLO)       '' *** this line returns an error (13) type mismatch....
End Sub

AutoCAD Customization: .NET: Solid3D IntersectWith problem

$
0
0

I want to check if two Solid3D entities intersect with each other. But the function IntersectWith is not yet implemented!
Any ideas how to solve my problem?

AutoCAD Customization: .NET: VB.NET Selection Set Convert VBA to .NET

$
0
0

So currently I'm trying to select objects that I am adding to the drawing. I want to add these to a selection set and then access that selection set through Interop. There is very little on the internet that I could find on doing something like this, but the command that I though might work, gives me an error,

acSSet2 = SelectionSet.FromObjectIds(ids)

 Here is a very summarized version of my code:

'Add the mirrored items to a new selection set
                    Dim acSSet2 As SelectionSet
                    Dim ids(15) As ObjectId
                    Dim int As Integer = 0
                    '' Step through the objects in the selection set
                    For Each acSSObj As SelectedObject In acSSet
                        
                        ' Add the new object to the block table record and the transaction
                        acBlkTblRec.AppendEntity(acEnt2)
                        acTrans.AddNewlyCreatedDBObject(acEnt2, True)
                        ids(int) = (acEnt2.ObjectId)
                        int = int + 1

                    Next
                    acSSet2 = SelectionSet.FromObjectIds(ids)


                        acadDoc = AcadApp.ActiveDocument

                        ssetObj = AcadApp.ActiveDocument.ActiveSelectionSet

                    acadDoc.Export(System.IO.Path.GetFullPath(acCurDb.Filename), "wmf", CType(acSSet2, AcadSelectionSet))

 I was hoping that when I added the items to acSSet2, AcadApp.ActiveDocument.ActiveSelectionSet would catch it and use it. But that didn't work so I added,

CType(acSSet2, AcadSelectionSet)

 but then it gave me this error

************** Exception Text **************
System.InvalidCastException: Unable to cast object of type 'Autodesk.AutoCAD.EditorInput.SelectionSetDelayMarshalled' to type 'Autodesk.AutoCAD.Interop.AcadSelectionSet'.
   at TestSelectingFiltering.TestSelecting.MyCommands.FilterBlueCircleOnLayer0()
   at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
   at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()

 Any help would be great, this has been driving me crazy!

Thanks!

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Autoloader, how to stop executing RIBBON, COMMANDLINE and DESIGNFEED

$
0
0
I made a so called "app" conform Autodesk requirements and it works the way it should except for some things. Everything is in %appdata%\Autodesk\ApplicationPlugins, in .bundle form. What this app does is build a standard user environment by changing out of the box AutoCAD settings, i.e. settings you get when you reset your profile via OPTIONS. Problems with TRUSTEDPATHS forced me to do a .bundle approach. If run as a .bundle AutoCAD 2014 is adding the following commands after acaddoc.lsp is loaded: RIBBON, COMMANDLINE and DESIGNFEED. Apparently these commands are not executed when one fires up acad.exe /b scriptname which was the old working solution until TRUSTEDPATHS came by. These commands ruin the environment but I have no clue what mechanism causes these commands to be issued. Can someone shine a light? A more detailed description and comment can be found at http://through-the-interface.typepad.com/through_the_interface/2013/03/autocad-2014-for-developers.html, ctrl-f "wiebe". A final note: the environment is knotted tight, users are very restricted and for that reason everything is written in LISP.

AutoCAD Customization: .NET: VB.NET Select attribute definitions (attdef) and change their values

$
0
0

Hi,

I would like to change attribute values but seems that I cannot access them and don't know why.

I was trying to select all attribute definitions in current drawing - successfuly - and then tried to change their values based on it's attribute tags.

 

It turned out that I cannot access them from the selection set. How can I do it then? Attribute definitions are not nested in blocks, just definitions in the drawings.

 

  Sub ChangeAttDefs()
            Using acDoc.LockDocument()
                Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
                    ' Create a TypedValue array to define the filter criteria
                    Dim acTypValAr(0) As TypedValue
                    acTypValAr.SetValue(New TypedValue(DxfCode.Start, "ATTDEF"), 0)
                    '' Assign the filter criteria to a SelectionFilter object
                    Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
                    '' Request for objects to be selected in the drawing area
                    Dim acSSPrompt As PromptSelectionResult = acDoc.Editor.SelectAll(acSelFtr)
                    If acSSPrompt.Status = PromptStatus.OK Then
                        Dim acSSet As SelectionSet = acSSPrompt.Value
                        '' Step through the objects in the selection set
                        For Each acSSObj As SelectedObject In acSSet
                            '' Open the selected object for write
                            Dim acAttRef As AttributeReference = acTrans.GetObject(acSSObj.ObjectId, OpenMode.ForWrite)
                            '' Change attribute values
                            If acAttRef.Tag = "TEST" Then
                                acAttRef.TextString = "WORKED"
                                Exit Sub
                            End If
                        Next
                        acTrans.Commit()
                    End If
                End Using
            End Using

        End Sub

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: select select an object and get the point I just picked and enames

$
0
0

I want to pick one object and the point I pick on the object I want to save it and I want all of the ename of it

 

((-1 . <Entity name: 7ffffb06660>) (0 . "LINE") (330 . <Entity name: 7ffffb039f0>) (5 . "346") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 4.64456 1.92781 0.0) (11 13.3127 8.70008 0.0) (210 0.0 0.0 1.0))


AutoCAD Customization: Visual LISP, AutoLISP and General Customization: shift and CRTL trick

$
0
0
how do you make it so if you hold shift down it change to something else like in trim and extend command if you hold the shift key down in the trim command autocad will start extending or the CTRL KEY if you hold it down in the arc command it draws the arc in the other direction

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: line commad wont osnap intersection just mid end or perp point

$
0
0

I am work on a new line command with some more option and it works fine unless I draw the line up to another line and run it accross the line to the angle I want it, it will not snap to the point it snaps to endp midp or prep If I have the intersection osnap on it will not snap to the point I am at htis is not all of the command I left out some of the (= null pt1)

 

(setq pt1a (getpoint "\nSpecify point")) 

(setq pt2 (getpoint pt1 "\nSpecify second point" ))
  (if (null pt2)
    (vl-exit-with-error "")
    )
  (command "_line" pt1 pt2 "")

(while

(setq ang1 (angtos (angle pt2 pt1) 0 1))

(command "angbase" pt2 pt1)

(initget "C D U")

(setq pt3 (getpoint pt2 "\nPick next Point or [Undo/Close]:"))

(cond

((null pt3)

(vl-exit-with-error "") );end null

((= 'LIST (type pt3))

(command "angbase" pt2 Pt1)

(command "_line" pt2 pt3 "")

(setq pt1 pt2)

(setq pt2 pt3)

(setq l (cons (entlast) l)) ); end list

((= pt3 "U")

(entdel (car l))

(setq l (cdr l))

(setq obj1 (cdr (assoc 10 (entget (entlast)))))

(setq obj2 (cdr (assoc 11 (entget (entlast)))))

(setq ob1 (list(car obj1) (cadr obj1)))

(setq ob2 (list(car obj2) (cadr obj2)))

(setq ang (angtos (angle ob2 ob1)))

(setq pt1 ob1) (setq pt2 ob2)

AutoCAD Customization: .NET: autocad map 3D insert Block error

$
0
0

Hi

I am try to insert Block into Layout in autocad map 3D 2014
but I get error if I try this in Autocad 2014 then it works well no error

 

can anyone help me please how I can fix this

 

Autodesk.AutoCAD.Runtime.Exception: eNotApplicable
at Autodesk.AutoCAD.EditorInput.Editor.UpdateTiledViewportsFromDatabase()

 

 

Namespace extracommands

      <CommandMethod("FRAME (A4)")> _
        Public Shared Sub setjainnramman()
               ApplicationMenu.frameA4()
           End Sub


 Public Class ApplicationMenu

        Public Shared Sub frameA4()
            Dim doc As Document = _
                         Application.DocumentManager.MdiActiveDocument
            Dim db As Database = _
                        doc.Database
            Dim tr As Transaction = _
                            db.TransactionManager.StartTransaction()

            Dim ed As Editor = doc.Editor

            Using tr
                Try
                    Dim layoutMgr1 As LayoutManager = _
                                            LayoutManager.Current
                    Dim layoutId As ObjectId = _
                                layoutMgr1.GetLayoutId("A4")
                    If layoutId.IsNull = True Then
                        tr.Abort()
                        Return
                    End If

                    Dim layoutObj As Layout = _
                                tr.GetObject(layoutId, _
                                            OpenMode.ForWrite, False)
                    Dim layId As ObjectId = _
                        layoutObj.BlockTableRecordId
                    Dim layoutBtr As BlockTableRecord = _
                                    tr.GetObject(layId, _
                                            OpenMode.ForWrite, True)

                    Dim id As ObjectId = Nothing
                    Dim bt As BlockTable = _
                                    tr.GetObject(db.BlockTableId, _
                                        OpenMode.ForRead, True)

                    Dim blkName As String = "A4-frame"

                    If bt.Has(blkName) Then
                        id = bt.Item(blkName)
                        Dim insPt As New Point3d(0.7566, 0.6746, 0)
                        Dim bref As BlockReference = _
                                    New BlockReference(insPt, id)
                        layoutBtr.AppendEntity(bref)

                        tr.AddNewlyCreatedDBObject(bref, True)
                        tr.Commit()
                    Else
                        tr.Abort()
                    End If

                Catch ex As System.Exception
                    ed.WriteMessage(ex.ToString())
                End Try
            End Using
        End Sub
   End Class

End Namespace

 

Regards

sgear

AutoCAD Customization: Autodesk ObjectARX: Text vetorization

$
0
0

Hello

 

We use RealDWG 2014.

 

We want to implement our own viewer using RealDWG. How can I vectorize text objects in AcGiWorldGeometry::text method? I know AutoCAD uses Heidi driver to render texts, are any samples describing how to solve this problem?

AutoCAD Customization: Autodesk ObjectARX: Saving custom entity, proxy object problem

$
0
0

Hi,

 

I created a simple custom object deriving from AcDbEntity in a dbx, and I'm facing issues when I tried to save this entity in a previous dwg version. Here are the steps to reproduce the problem:

  1. Launch AutoCAD 2013 (or 2014) and load the dbx
  2. Create an instance of the custom entity
  3. Save the dwg in version 2013
  4. Restart AutoCAD 2013 (or 2014), but don't load the dbx
  5. Open the dwg created in step 3 (the custom object appears as PROXY OBJECT, it's normal)
  6. Save the dwg in version 2010 (with save as...)
  7. Launch AutoCAD 2010 (or 2011 or 2012) and load the dbx (compiled for the right version)
  8. Open the dwg created in step 6
  9. Custom object appears as PROXY OBJECT --> why ???

I read AutoCAD developer's guide (chapter Custom Objects -> Deriving from AcDbObject -> Object Version Support) about birth and filer version, but I didn't understand what I need to do. Does anyone have the same problem? Is this is a normal behavior of AutoCAD?

 

Regards,

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: "DWF Markup Core" Error

$
0
0

After some windows updates I have users who get an error message loading a drawing with a PDF in it. The error says "C:\Program Files\Autodesk\AutoCAD Civil 3D 2013\acdwfmarkupcore.crx cannot find a dll or other file that it needs." and the PDF's in that drawing come up as unloaded and won't reload. When trying to attach a file to these there is a invalid file message that pops up (see attached). Users are on Civil3D 2013 SP2. Users on SP1 don't seem to have the problem either. Neither do users on non updated OS (the update for win 7 when the win 8.1 update was released). Win7 ultimate x64 seems to be the only OS this is happening on. Is anyone familiar with this error?

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Prompting with a Dynamic Options list & Dynamic Default Option?

$
0
0

Hi all,

 

I'm attempting to build a selection set to determine if certain conditions are met before a getkword prompt that needs the options constructed based on the selection set succeeding or failing. Using an example found elsewhere I have this:

 

(IF (SSGET "x" '((8 . "POOL") (-4 . "<OR") (62 . 5) (62 . 256) (-4 . "OR>")))
  (SETQ	*GROPTS* (CONS "Circle Fillet inPlace Quadrant Tangent StartOver"
		       "Circle/Fillet/inPlace/Quadrant/Tangent/StartOver"
		 )
  )
  (SETQ	*GROPTS* (CONS "Circle Fillet inPlace Overall Quadrant Tangent StartOver"
		       "Circle/Fillet/inPlace/Overall/Quadrant/Tangent/StartOver"
		 )
  )
)
(INITGET (CAR *GROPTS*))
(SETQ *RADTYP*
       (COND
	 ((GETKWORD (STRCAT "\nSpecify Use ["
			    (CADR *GROPTS*)
			    "] <"
			    (SETQ *RADTYP* (COND (*RADTYP*)
						 ("Circle")
					   )
			    )
			    ">: "
		    )
	  )
	 )
	 (*RADTYP*)
       )
)

 It appears that plugging in the (CADR *GROPTS*) into the STRCAT is causing an error. How should I go about doing this correctly?

 

Thank you.


AutoCAD Customization: .NET: MdiActiveDocument | Set Active Drawing??

$
0
0

Hi All,

I know this was discussed many times here and spent a few hours of reading but did not find solution for my issue (also if I found very similar issues).

 

I run my command from "Drawing1.dwg". That command opens an existing drawing and does some updates in new opened drawing. The issue is that all the changes are made in "Drawing1.dwg and not on that new opened drawing.

 

Basically, I want to open a drawing, do some modifications and close it. Everyhing works fine in my long code just not in drawing I would wish.

 

Here is an really short example (there is more declarations than needed just taken quickly from project):

 

Imports System
Imports System.IO
Imports Excel = Microsoft.Office.Interop.Excel
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.AutoCAD.Windows
Imports Autodesk.AutoCAD.Colors   

Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim acCurDb As Database = acDoc.Database
        Dim acDocEd As Editor = acDoc.Editor
        Dim acDocMgr As DocumentCollection = Application.DocumentManager
        Dim acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()


<CommandMethod("runmymacro", CommandFlags.Session)>
        Public Sub myownMacro()
            Using acDoc.LockDocument
                Dim strDwgFileName As String = "c:\test.dwg"

                If (File.Exists(strDwgFileName)) Then
                    acDocMgr.Open(strDwgFileName, False)

                    Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
                        Dim acBlkTbl As BlockTable = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead)
                        Dim acBlkTblRec As BlockTableRecord = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)
                        Dim acObjId As ObjectId
                        For Each acObjId In acBlkTblRec
                            ''here I am doing something with entities but it skips this step as there are no objects in "Drawing1.dwg". It is not working
                            ''with opened drawing "c:\test.dwg"
                        Next
                    End Using
                End If
            End Using
        End Sub

 

I am sure that I am doing something wrong or probably I missed something on all the posts I read here.

Many thanks for any help.


Peter

 

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Prompting with Dynamic Options List & a Default Option?

$
0
0

Hi all,

 

  I am complicating an example for "Prompting with a Dynamic Default Option" from promptwithdefault. I am now trying to change the options depending on conditions being met withing the model space of the drawing.for example if a selectionset has been made sucsefully then the required condition has been met allowing more options to become available to the user. The following code seems resonable to me but it throws an error: bad argument type: stringp ("Beta/" "Gamma"). The Beta & Gamma is what I'm after but I don't understand why the error or how to do what I want correctly.

 

(setq *ans* (cond ((getkword (strcat "\nChoose [" (cdr '("Alpha/" "Beta/" "Gamma")) "] <" (setq *ans* (cond ( *ans* ) ( "Alpha" ))) ">: ")))( *ans* )))

 Thank you in advance for any help or insights.

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: How to get to the colors in AutoCAD 2014

$
0
0

I am trying to access the colors in LISP 2014. Scrip worked fine in AutoCAD 2012. Anybody knows what is wrong now?

(vla-GetInterfaceObject

(vlax-get-acad-object)

"AutoCAD.AcCmColor.18"

)

 

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: Xref relative path Lisp

$
0
0

Hey guys,

 

Because we soon going to change our server, all our path will change and so I'm trying to set all my xref-path from absolute to relative path.

I already searched the web for a soultion, but didn't find any good ones, that would help me.

 

I'd like to do this with lisp, so everytime I open a file it runs this and checks if it and changes the path to relative.

I don't know if there is a easier way to do this for many files at once without opening them...maybe with the referencemanager?

 

thanks for your help guys!

klingi

AutoCAD Customization: Visual LISP, AutoLISP and General Customization: convert rectangular dimensions to text

$
0
0

hi everybody ,

 

i need a lisp for convert rectangular dimension to text ..

 

when i click  to recangle and after to text , the routine will paste rectangle dimensions to text as A x B ( A= X dirextion , B=Y direction)

 

and plus i need similar one lisp too . that one will copy values from dimensions text which i click X dimension and after Y dimension , the routine  will paste to text A x B  just like first example ..

 

 

thank you for your help

 

 

 

 

 

 

 

 

 

 

Viewing all 1680 articles
Browse latest View live


Latest Images

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