AutoCAD VB :: Check Block Insert Within Certain Coordinate?

Nov 2, 2011

The below VBScript code is from a property set definition in AutoCAD MEP...

The below works to return the effective name of a block that exists with a certain entity handle. How might I check if the blocks insertion point is at a particular coordinate by a fuz factor? ... and then if is not set then clear out the XData?

On Error Resume Next
Set AcadApp =  GetObject(,"AutoCAD.Application")
AcadVerString = AcadApp.ActiveDocument.GetVariable("ACADVER")
Select Case AcadVerString
   Case "18.1s (LMS Tech)"
    aecBaseVer = "AecX.AecBaseApplication.6.5"
 
[Code] ...

View 1 Replies


ADVERTISEMENT

AutoCAD .NET :: How To Check And Manage Unit To Insert Block Reference

Feb 26, 2012

I have a VBA code for check and choose unit but how i can in .NET ?

Unite = ThisDrawing.GetVariable("INSUNITS") Select Case Unite Case 4: Unite = 10 'mm Case 5: Unite = 1 'cm Case 6: Unite = 0.01 'm Case Else: Unite = 1 End Select

db.UnitMode is always = 0

i have try this :

Dim BlocT As BlockTable Dim tr As Transaction = db.TransactionManager.StartTransaction BlocT = tr.GetObject(db.BlockTableId, OpenMode.ForRead) Dim Bloc As BlockTableRecord Bloc = tr.GetObject(BlocT(BlockTableRecord.ModelSpace), OpenMode.ForRead) Dim lay As Layout = tr.GetObject(Bloc.LayoutId, OpenMode.ForRead) tr.Commit() tr.Dispose()
 but bloc.units dont egal the unit command in autocad.

I can use  :

Dim obj As Object = Application.GetSystemVariable("INSUNITS")

but i want a proper solution with .net.

View 1 Replies View Related

AutoCAD .NET :: Insert Drawing To Specific Coordinate?

Sep 24, 2012

Am trying to insert a drawing to specific coordinates, till now i did this part of coding; though this is executing but the drawing is not getting to coordinates specified

public void coordinates()
{
string dwgName = HostApplicationServices.Current.FindFile("D:\AutoCAD DWG's\SE-02416_37_A.dwg", acadApp.DocumentManager.MdiActiveDocument.Database, FindFileHint.Default);
//Database db1 = new Database(false, false);
Database db1 = new Database(false, false);
//db1.ReadDwgFile(dwgName, System.IO.FileShare.Write, true, "");
db1.ReadDwgFile(dwgName, FileOpenMode.OpenForReadAndWriteNoShare, true, "");

[code]....

View 3 Replies View Related

AutoCAD .NET :: Insert Block From External DWG File / Specify Insert Point By Click Mouse

Apr 2, 2013

I write a program, this program needs to insert some standard illustrations. I made these standard illustrations into different blocks. And I store these blocks in a dwg file. Everytime I need to insert some illustrations, I just click the mouse on the current drawing, I want the illustration inserted. These means the following points:

(1) Import the blocks to the current drawing, if the blocks have already been imported, then do nothing.

(2) Specify the insert point by clicking the mouse, and I want the block's insert point to coincide with the mouse clicking point.

View 1 Replies View Related

AutoCAD VB :: OCS Coordinate System Of Block To UCS Or WCS Coordinate System?

May 28, 2012

I want to know how to transform OCS Coordinate of A block object to UCS or WCS Coordinate .

It's Block's OCS   Coordinate  not other objects.

View 7 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Block Attribute Then Change Different Attribute In Block

Aug 31, 2012

select all blocks on certain layers in a drawing, check attribute CIRCUIT in each block if it starts with MS then attribute CONTROL = switched. I hope thats clear enough the way

(defun c:control()
(graphscr)
(Setq sc (ssget "X" '((0 . "INSERT")

[Code].....

View 1 Replies View Related

AutoCAD 2010 :: Dynamic Block Grips - Block Does Not Change When Insert In Another File

Oct 28, 2013

I have created a dynamic block with a stretch, flip and rotate.  Everything works great in its file.  When I insert it in another file, the grips move but the block does not change.

AutoCAD 2014

View 2 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Point At List Block And Dynamic Block

Apr 18, 2013

I am learning autolips and i found  a problem that i can´t solved.
 
(vl-load-com)(defun c:pmb ( / ss ent pt )(prompt "
selec block : ")(setq ss (ssget '((0 . "INSERT")))) (setq ent (ssname ss 0)), (setq pt (cdr (assoc 10 (entget ent)))) (command "point" pt))
 wich this code you select one block and insert one point at insert point´s block.

which this other code yo select all block and insert all  point.... but in one block
 
(vl-load-com) (defun c:pmb11 ( / sele cod bloque nbloque lista pt ) (prompt "
block: ") (setq sele (ssget ( List'(0 . "INSERT"))) Cod 0 )cod (1+ cod) (repeat (sslength sele) (setq bloque (ssname sele cod)) (setq pt (cdr (assoc 10 ( entget bloque)))) (command "punto" pt) );repeat ) 

View 4 Replies View Related

AutoCad 2D :: Using Block X-coordinate To Get Station

May 21, 2012

I currently have my elevation view set up so that the x-coordinates correspond to the stationing along my structure and the y-coordinate corresponds to the elevations. I have a block that will insert the y-coordinate as it should. However, the x-coordinate requires some formatting so that it is shown properly (e.g. "10+00").

I have an attribute equal to a the x-coordinate divided by 100 with the precision changed to 0. So, if my point is 1016.123, the formula converts that to 10. This field is followed by a plus sign and then another field. This last field is equal to the x-coordinate minus the x-coordinate converted as before, then times 100. The purpose being that if my x-coordinate is 1016.123, I would get 16.123 and my block attribute would reflect 10+16.123. The problem is that AutoCAD retains all of the x-coordinate's precision when subtracting and I end up with a result of 0. See attached for clarity - I know this last bit is hard to understand if you can actually see what's going on.

I understand that I could subtract out 1000, but when my stationing is beyond 20+00, I will only be subtracting 1000 and my result will not be correct.

View 3 Replies View Related

AutoCAD LT :: Block Coordinate System?

Oct 3, 2011

When I click on a block in my drawing the properties bar shows "position x" and "position y" but these coordinates do not match up at all with the x,y coordinates shown in the bottom left corner of the screen. For example, my cursor over the block is at about 370000,4900000 but the block position is 170000, -140000. Is there a different coordinate system the block position is referring to?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert A Block / Explode And Rename Nested Block With Suffix

Nov 30, 2012

I have a block that i want to insert several times and revised each one to be different to do this i would have to insert it and rename the blocks that come in and then reinsert i would like to insert and have a lisp explode the main block and rename the other 2 blocks with a suffix at the end depending on how many times its in the drawing... can this even be done? My original block name that will be first inserted is "BENT PULLEY NOTES" it needs to explode after i drop it in and then there are 2 blocks within that called "Bent Pulley" and "Bent Pulley DYN" that i was hoping to keep the names but add a number at the end depending on how many are in the drawing already...

here is a lisp that i have found... it would work if i didn't have nested blocks and only wanted the one block to be insert and not explode...

(defun c:Test (/ e i name Bname )
(setq e nil)
(command "_.-insert" "Drawing1.dwg" pause "" "" "")
(if (setq e (entlast))

[Code] .......

View 9 Replies View Related

AutoCAD .NET :: Insert Block And Drag Jig Hiding Inserted Block At 0,0

Apr 11, 2013

I have a pallete button that inserts a block then a drag jig to position it. The block is first inserted at 0,0 and dragged.

The block at 0,0 remains visible while a "duplicate" block is dragged. Is there a way to hide the original?
 
Insert block then calling the drag jig..
AddViewBlock(New Point3d(0, 0, 0), 0, ColorIndex, trans) psr = ed.SelectLast() DragView(psr.Value, "Bar Insertion Point")
 
In the DragView procedure I have:

 Public Sub DragView(ByVal SS As SelectionSet, ByVal sPrompt As String)
'....
Dim ppr As PromptPointResult = ed.Drag(SS, vbLf & sPrompt, New DragCallback(AddressOf MyDragCallback))

View 4 Replies View Related

AutoCAD .NET :: Insert Dynamic Block And Position And Stretch The Block?

Apr 6, 2013

I am trying to insert a dynamic block and position and stretch the block, using the linear parameters, depending on values entered into a form.

I managed to create a form that would draw a series of boxes. And i managed to create a routine that would insert a block and size it depending on fixed values but i can't link the 2 together.

Win 7 Pro 64bit, Dell Precision M6500

View 8 Replies View Related

AutoCad :: How To Delete Block From Insert Block List

Oct 20, 2007

I am using Autocad 2007 I made several blocks with att. And I use this drawing and copy it to the samples/design center folder so that I can see the blocks that I created on the Design center window for use on different other drawings.

My problem is that if I make a cange on the ORIGINAL block drawing how can I update the inserted blocks on the other drawings? I try to delete the block from the local drawing insert block list (is this possible?) to paste the block again with the new changes, but somehow even when I grab the new modified block to inserted again when I do it, it takes the shape of the old version!

View 6 Replies View Related

AutoCad :: Create Block To Insert On Title Block

Oct 26, 2012

Is it possible to create a block to insert on our title block that will populate itself with a list of drawings and names?

I know this is possible through the use of LISP and the Sheet Set Manager, but could this be done through a combination of attributes and fields (we want the same functionality in LT).

View 1 Replies View Related

AutoCad :: Check Spelling Of Attribute Within Block

Jul 8, 2011

Is it possible for AutoCAD to check the spelling of an attribute within a block and confirm if it matches a word in a list of names in an excel file or table in another AutoCAD file?

This is required because the attribute then gets exported to be inserted into another database program and the spelling has to be exact otherwise it will error. The list of names to check are colours and there are approx. 100 of them.

What would be perfect is if the attribute is a drop down list which is a live list of the colours in the excel file, but I dont think this is possible?

View 0 Replies View Related

AutoCad :: How To Test Block To Check All Necessary Constraints

Nov 24, 2013

I'm testing out a simple Block Table in the Dynamic Block editor and when I go to save the Block, the following alert pops up. Is there a way to "test" the Block to check all the necessary constraints? Or am I just suppose to go about this with good 'ol fashioned trial and error? Seems the block is working just fine so is the alert just a moot point?

fully_cons.PNG

View 4 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Insert Point At Block Insert Point

Sep 26, 2012

trying to insert point instead of block.

(setq blok (entget (car (entsel))))

(setq point (cdr (assoc 10 blok)))

(setq XX (rtos (car point) 2 20)) ;; x koordinata bloka

(setq YY (rtos (cadr point) 2 20)) ;; y koordinata bloka

(setq ZZ (rtos (caddr point) 2 20)) ;; z koordinata bloka

(command "point" xx,yy,zz) is not working

!xx="5582453.414999999" but when i (atoi xx) i get 5582453 no dedimals...

how to create valid insertation point from xx, yy and zz?

View 6 Replies View Related

AutoCAD .NET :: Insert Block Reference Using Block Name

Nov 17, 2012

Drawing contains a block with "BlkName". I want to insert blockreferences of this existing block using .Net. All shows how to insert a new block and then use the BlockID returned by the insert function. In my case I only have the block name and there is no Block id. How to get it or how to create a block reference of an existing block?

View 3 Replies View Related

AutoCAD Visual LISP / AutoLISP :: Check Attribute Of Block With External Database

Mar 2, 2013

I have a block with:

tag1: XX

tag2: YYYYYY

tag3: ZZZZZZZZ

I have an external file check.txt with string:

XXYYYYYYZZZZZZZZ

I would like to create a lisp program that check the attributes of block using an external database, if tag1+tag2+tag3 = XXYYYYYYZZZZZZZZ ok end program, if not  make a circle on block :

View 3 Replies View Related

AutoCAD LT :: Insert Using Block Name

Oct 12, 2012

Using the command -insert -blockname = filename successfully? What I have tried is:

^C^C_-insert;"Insulation - 25-50mm"="K:/All Staff Personal Folders/Personal_Charles Edwards/Autocad/Blocks/Detail Blocks/Insulation - 25-50mm.dwg";

Trying to run this I get:

Command: _-insert
Enter block name or [?]: Blockname="K:/All
""K:/All.dwg": Invalid file name.
*Invalid*

View 4 Replies View Related

AutoCAD .NET :: Insert Block From Other DWG

Nov 12, 2012

I have to write a procedure for insert a block with attributes from an external file and set the annotative scale block to current scale. where I cand find an examples?

View 2 Replies View Related

AutoCAD .NET :: Insert Block With Different Name

May 3, 2011

is there a way to insert a block in the drawing, but with a different name, so it can be edited separately?

I have block A in the drawing and i want to insert it again, but then edit it while the ones already inserted stay unchanged. So i would need it to be inserted as A_1.

View 1 Replies View Related

AutoCAD .NET :: Insert 3D Block Into UCS

Aug 24, 2013

I defined a 3d block..It is defined along X axis...I want to insert it into a ucs by picking 2 points( insertion, and direction) and that Block Z axis to be parallel with UCS z axis

I insert the block first then I rotated it..I have got this

P1 is insertion poit

P2 is the point for direction

P1 world is p1.transformby(current ucs)

Dim Xax_block As Vector3d = Block1.BlockTransform.CoordinateSystem3d.Xaxis.TransformBy(Block1.BlockTransform)
 Dim VectorP12 As Vector3d = P1_world.GetVectorTo(P2_world)
    Dim RotAX As Vector3d = Xax_block.CrossProduct(VectorP12) ' here is calculating the perpendicular vector between x axis of the block and the vector from point1 and point2
      Dim Rotation1 As Double = Xax_block.GetAngleTo(VectorP12)
      Block1.TransformBy(Matrix3d.Rotation(Rotation1, RotAX, P1_world))

By picking 2 points is inserting the block along the line between 2 points...But is not having as normal the z axis of the ucs..

View 2 Replies View Related

AutoCad :: How To Insert 3D Block

Feb 29, 2012

I have a problem with inserting 3d blocks in autocad 2011. While inserting a block, i specify insertion point on-screen and blocks seems to be inserted to right place but block itself is far away from the drawing (eg. if i type zoom --> extens = drawing and inserted block are totally different locations on model screen.)

View 1 Replies View Related

AutoCAD .NET :: Insert Block - Workflow?

Apr 27, 2012

Am I along the correct workflow path here? I want to insert a drawing as a block into my current drawing. Before I start writing code I want to make sure I understand the steps.

Open Transaction
Wblock Drawing to Temp Database
Now have my New BlockTableRecord Object 
Copy BlockTableRecord to ActiveDwg.Database
Create New BlockReference
Add attributes 
Set Scale Properties
Set Insertion Point
Set Rotation 
Append BlockReference to Database
Commit Transaction

Am I missing any of the steps? 

Is this how I would imidate the old VBA modelspace.insertblock(myPoint, "C:pathpathpathlock.dwg",1,1,1,0)

View 6 Replies View Related

AutoCAD .NET :: Insert Block From Another File?

Jul 5, 2012

I am inserting a block from another file to the current drawing file.

I am using C#.Net.

My block gets added into the blocktable record of the current file, but while inserting the block using the "Block" command in AutoCAD its shows an error "The Existing Block has not been modified" I have attached a screenshot of the message i am getting.

I want to insert the block automatically to a user specified location.

View 5 Replies View Related

AutoCAD .NET :: Repeatedly Insert Block

Jan 17, 2012

So i've been able to successfully import a single block at a time into an active drawing, now i'm trying to insert the same block multiple times to essentially create a layout within the drawing. How would i go about inserting a selected block "x" amount of times. What i've got so far is this:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

[Code] .....

ideally this next section will iterate the import process "x" amount of times and allow for effetive block placement!

Below is part of some code that i had used to copy a paperspace layout "x" amount of times. I understand the iteration part but am not sure how to apply it to a block. I don't know how to reference the block that i intend to insert and then have it populate "x" amount of times.

/*
for (int i = 1; i <= numLayouts; i++){
lm.CopyLayout("Layout1", "SP-" + i.ToString());
Layout layout = (Layout)trx.GetObject(lm.GetLayoutId("SP-" + i.ToString()), OpenMode.ForWrite);
}
[Code] .......

View 9 Replies View Related

AutoCAD .NET :: Insert One Block With 3 Attributes

Apr 24, 2013

I have this one file .txt with this features:

Point       North                   East                Z        Description

1          8618063,68       312415,09         75,87    T1
2          8618138,38       312428,89         70,57    B_RIO SECO
3          8618132,23       312427,75         71,90    ARENAL
4          8618126,23       312426,64         72,50    ARENAL
5          8618112,22       312424,06         73,77    ARENAL
6          8618099,78       312421,76         75,35    ARENAL
7          8618089,51       312419,86         75,84    ARENAL
8          8618132,23       312427,75         71,94    J
9          8618112,23       312424,06         73,88    J
10        8618099,82       312421,78         75,36    ARENAL
11        8618089,48       312419,87         75,85    E_1

And I generated this code for read this file and insert one block with attributes for each line of text…..

If txtPath.Text() = "" Then
MsgBox("Select DB .txt.", MsgBoxStyle.Exclamation)
End If
On Error GoTo ControlErroresBD
Dim AcadDocPt As Document =
[Code] ....

‘To the end of this line I can insert the block,,,,,,, but I don’t know how to write the attributes…… I tried with the next code but it doesn’t work…. My bloque has 3 attributes and every tag named with “PN”, “CD” and “CT”

Dim AcadObj As Entity
For Each acObjId As ObjectId In AcadBlockRef.AttributeCollection
AcadObj = AcadTransPt.GetObject(acObjId, OpenMode.ForWrite)
Dim acAttDef As AttributeDefinition = TryCast(AcadObj, AttributeDefinition)

[Code] .....    

View 9 Replies View Related

AutoCAD LT :: Insert Block By Dialog Box

Apr 4, 2013

I'm trying to insert a block using the "insert dialogue box". However, when I do, if I have the box for "insertion point" unchecked, I get the error "Block Insertion Failed" (picture 1).

If I check that box, I get the error "*Invalid* Block references itself". I have purged the drawing and there are no other blocks in the drawing.

View 9 Replies View Related

AutoCAD .NET :: Insert Block With Preview

Oct 28, 2011

I insert a block with Database.Insert(). I get the insertion point with Editor.GetPoint().

What I would like is to see a 'preview' of the block that is to be inserted, while selecting the insertion point, similar as AutoCAD's INSERT command. Is that possible and how?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved