.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is it possible to hide an object?

10 REPLIES 10
Reply
Message 1 of 11
hericson
745 Views, 10 Replies

Is it possible to hide an object?

I'm writing my own lengthen dynamically function and I'm using a jig to get the new end point. What I want is to hide the line while using the jig and after getting the new end point from the jig I will unhide the line and change the line's endpoint. Is that possible or do I have to first erase the line and then recreate it after the jig has got the new end point? In that case I have to save all possible properties that I can get from the line so I can apply them to the new line object, it sounds that it's a big chance of missing something.
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: hericson

Entity.Visible?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6368009@discussion.autodesk.com...
I'm writing my own lengthen dynamically function and I'm using a jig to get the
new end point. What I want is to hide the line while using the jig and after
getting the new end point from the jig I will unhide the line and change the
line's endpoint. Is that possible or do I have to first erase the line and then
recreate it after the jig has got the new end point? In that case I have to save
all possible properties that I can get from the line so I can apply them to the
new line object, it sounds that it's a big chance of missing something.
Message 3 of 11
hericson
in reply to: hericson

Sometimes it's too easy. I was looking for something similar but searched for Hide/Unhide, Visible never occur'd to me.

But now I have a new question, look in the code below (it's not complete, I know), how can I make it invisible before calling the jig? If I use acTrans.Commit then I can't continue without errors. Do I have start a new Using?

{code}
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
lin.Visible = False

' call the jig

lin.Visible = True
acTrans.Commit()
End Using
{code}
Message 4 of 11
Anonymous
in reply to: hericson

First, use the Document's TransactionManager, not the
Database's TransactionManager.

See if this works:

{code}

Document doc = ....

using( Transaction tr = doc.TransactionManager.StartTransaction () )
{
Line line = ....// assign to line to hide
using( Transaction inner = doc.TransactionManager.StartTransaction() )
{
line.Visible = false;
inner.Commit();
}

// jig here....

line.Visible = true;
tr.Commit();
}

{code}

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6368695@discussion.autodesk.com...
Sometimes it's too easy. I was looking for something similar but searched for
Hide/Unhide, Visible never occur'd to me.

But now I have a new question, look in the code below (it's not complete, I
know), how can I make it invisible before calling the jig? If I use
acTrans.Commit then I can't continue without errors. Do I have start a new
Using?

{code}
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
lin.Visible = False

' call the jig

lin.Visible = True
acTrans.Commit()
End Using
{code}
Message 5 of 11
hericson
in reply to: hericson

No, it didn't work. I even tried a new Line assignment with the inner transaction but no success.
Message 6 of 11
Anonymous
in reply to: hericson

I think you need to enable graphics fllush:

{code}

Document doc = ....

using( Transaction tr = doc.TransactionManager.StartTransaction () )
{
doc.TransactionManager.EnableGraphicsFlush(true);
Line line = ....// assign to line to hide
using( Transaction inner = doc.TransactionManager.StartTransaction() )
{
line.Visible = false;
inner.Commit();
}
doc.Editor.UpdateScreen();

// jig here....

line.Visible = true;
tr.Commit();
}

{code}


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6368927@discussion.autodesk.com...
No, it didn't work. I even tried a new Line assignment with the inner
transaction but no success.
Message 7 of 11
hericson
in reply to: hericson

Still the same...
Message 8 of 11
Anonymous
in reply to: hericson

Where are you calling the code from? A regular command,
A modeless dialog or palette?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6369577@discussion.autodesk.com...
Still the same...
Message 9 of 11
Anonymous
in reply to: hericson

See the attached example.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6369577@discussion.autodesk.com...
Still the same...
Message 10 of 11
hericson
in reply to: hericson

Now it works, thanks! But one conclusion is that you can't nest transactions.
Message 11 of 11
Anonymous
in reply to: hericson

Actually, the hack I posted isn't necessary.

What I overlooked was that it's also necessary to call
the TransactionManager's QueueForGraphicsFlush()
method just before calling FlushGraphics().

With that change you can avoid having to repeatedly
start/commit the outermost transaction.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6370416@discussion.autodesk.com...
Now it works, thanks! But one conclusion is that you can't nest transactions.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost